Move documantation to cpp file.

--HG--
branch : feature
This commit is contained in:
dismine 2014-06-13 20:02:41 +03:00
parent 7fed35ad1c
commit a755089a99
90 changed files with 2802 additions and 2892 deletions

View File

@ -34,6 +34,10 @@
#include "widgets/vapplication.h" #include "widgets/vapplication.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief TableWindow constructor.
* @param parent parent widget.
*/
TableWindow::TableWindow(QWidget *parent) TableWindow::TableWindow(QWidget *parent)
:QMainWindow(parent), numberDetal(nullptr), colission(nullptr), ui(new Ui::TableWindow), :QMainWindow(parent), numberDetal(nullptr), colission(nullptr), ui(new Ui::TableWindow),
listDetails(QVector<VItem*>()), outItems(false), collidingItems(false), tableScene(nullptr), listDetails(QVector<VItem*>()), outItems(false), collidingItems(false), tableScene(nullptr),
@ -76,6 +80,9 @@ TableWindow::~TableWindow()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddPaper add to the scene paper and shadow.
*/
void TableWindow::AddPaper() void TableWindow::AddPaper()
{ {
qreal x1, y1, x2, y2; qreal x1, y1, x2, y2;
@ -91,6 +98,9 @@ void TableWindow::AddPaper()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddDetail show on scene next detail.
*/
void TableWindow::AddDetail() void TableWindow::AddDetail()
{ {
if (indexDetail<listDetails.count()) if (indexDetail<listDetails.count())
@ -120,6 +130,11 @@ void TableWindow::AddDetail()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ModelChosen show window when user want create new layout.
* @param listDetails list of details.
* @param description pattern description.
*/
/* /*
* Get details for creation layout. * Get details for creation layout.
*/ */
@ -148,6 +163,10 @@ void TableWindow::ModelChosen(QVector<VItem*> listDetails, const QString &fileNa
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief closeEvent handle after close window.
* @param event close event.
*/
void TableWindow::closeEvent(QCloseEvent *event) void TableWindow::closeEvent(QCloseEvent *event)
{ {
event->ignore(); event->ignore();
@ -155,6 +174,9 @@ void TableWindow::closeEvent(QCloseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief moveToCenter move screen to the center of window.
*/
void TableWindow::moveToCenter() void TableWindow::moveToCenter()
{ {
QRect rect = frameGeometry(); QRect rect = frameGeometry();
@ -163,6 +185,10 @@ void TableWindow::moveToCenter()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief showEvent handle after show window.
* @param event show event.
*/
void TableWindow::showEvent ( QShowEvent * event ) void TableWindow::showEvent ( QShowEvent * event )
{ {
QMainWindow::showEvent(event); QMainWindow::showEvent(event);
@ -170,6 +196,9 @@ void TableWindow::showEvent ( QShowEvent * event )
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief StopTable stop creation layout.
*/
void TableWindow::StopTable() void TableWindow::StopTable()
{ {
hide(); hide();
@ -182,6 +211,9 @@ void TableWindow::StopTable()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief saveScene save created layout.
*/
void TableWindow::saveScene() void TableWindow::saveScene()
{ {
QMap<QString, QString> extByMessage; QMap<QString, QString> extByMessage;
@ -261,6 +293,10 @@ void TableWindow::saveScene()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemChect turn off rotation button if don't selected detail.
* @param flag true - enable button.
*/
void TableWindow::itemChect(bool flag) void TableWindow::itemChect(bool flag)
{ {
ui->actionTurn->setDisabled(flag); ui->actionTurn->setDisabled(flag);
@ -268,6 +304,9 @@ void TableWindow::itemChect(bool flag)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief checkNext disable next detail button if exist colission or out details.
*/
void TableWindow::checkNext() void TableWindow::checkNext()
{ {
if (outItems == true && collidingItems == true) if (outItems == true && collidingItems == true)
@ -293,6 +332,11 @@ void TableWindow::checkNext()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemOut handled if detail moved out paper sheet.
* @param number Number detail in list.
* @param flag set state of detail. True if detail moved out paper sheet.
*/
void TableWindow::itemOut(int number, bool flag) void TableWindow::itemOut(int number, bool flag)
{ {
listOutItems->setBit(number, flag); listOutItems->setBit(number, flag);
@ -311,6 +355,11 @@ void TableWindow::itemOut(int number, bool flag)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemColliding handled if we have colission details.
* @param list list of colission details.
* @param number 0 - include to list of colission dcetails, 1 - exclude from list.
*/
void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number) void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
{ {
//qDebug()<<"number="<<number; //qDebug()<<"number="<<number;
@ -378,12 +427,18 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetNextDetail put next detail on table.
*/
void TableWindow::GetNextDetail() void TableWindow::GetNextDetail()
{ {
AddDetail(); AddDetail();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddLength Add length paper sheet.Збільшує довжину листа на певне значення за один раз.
*/
void TableWindow::AddLength() void TableWindow::AddLength()
{ {
QRectF rect = tableScene->sceneRect(); QRectF rect = tableScene->sceneRect();
@ -400,6 +455,9 @@ void TableWindow::AddLength()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveLength reduce the length of paper sheet. You can reduce to the minimal value only.
*/
void TableWindow::RemoveLength() void TableWindow::RemoveLength()
{ {
if (sceneRect.height() <= tableScene->sceneRect().height() - 100) if (sceneRect.height() <= tableScene->sceneRect().height() - 100)
@ -426,6 +484,10 @@ void TableWindow::RemoveLength()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief keyPressEvent handle key press events.
* @param event key event.
*/
void TableWindow::keyPressEvent ( QKeyEvent * event ) void TableWindow::keyPressEvent ( QKeyEvent * event )
{ {
if ( event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return ) if ( event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return )
@ -440,6 +502,10 @@ void TableWindow::keyPressEvent ( QKeyEvent * event )
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SvgFile save layout to svg file.
* @param name name layout file.
*/
void TableWindow::SvgFile(const QString &name) const void TableWindow::SvgFile(const QString &name) const
{ {
QSvgGenerator generator; QSvgGenerator generator;
@ -460,6 +526,10 @@ void TableWindow::SvgFile(const QString &name) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief PngFile save layout to png file.
* @param name name layout file.
*/
void TableWindow::PngFile(const QString &name) const void TableWindow::PngFile(const QString &name) const
{ {
QRectF r = paper->rect(); QRectF r = paper->rect();
@ -478,6 +548,10 @@ void TableWindow::PngFile(const QString &name) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief PdfFile save layout to pdf file.
* @param name name layout file.
*/
void TableWindow::PdfFile(const QString &name) const void TableWindow::PdfFile(const QString &name) const
{ {
QPrinter printer; QPrinter printer;
@ -503,6 +577,10 @@ void TableWindow::PdfFile(const QString &name) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief EpsFile save layout to eps file.
* @param name name layout file.
*/
void TableWindow::EpsFile(const QString &name) const void TableWindow::EpsFile(const QString &name) const
{ {
QTemporaryFile tmp; QTemporaryFile tmp;
@ -515,6 +593,10 @@ void TableWindow::EpsFile(const QString &name) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief PsFile save layout to ps file.
* @param name name layout file.
*/
void TableWindow::PsFile(const QString &name) const void TableWindow::PsFile(const QString &name) const
{ {
QTemporaryFile tmp; QTemporaryFile tmp;
@ -527,6 +609,11 @@ void TableWindow::PsFile(const QString &name) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief PdfToPs use external tool "pdftops" for converting pdf too eps or ps format.
* @param params string with parameter for tool. Parameters have format: "-eps input_file out_file". Use -eps when
* need create eps file.
*/
void TableWindow::PdfToPs(const QStringList &params) const void TableWindow::PdfToPs(const QStringList &params) const
{ {
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR

View File

@ -45,63 +45,32 @@ class TableWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /** @brief numberDetal show count details, what need placed. */
* @brief numberDetal show count details, what need placed.
*/
QLabel* numberDetal; QLabel* numberDetal;
/**
* @brief colission show if exist colissions. /** @brief colission show if exist colissions. */
*/
QLabel* colission; QLabel* colission;
/**
* @brief TableWindow constructor.
* @param parent parent widget.
*/
explicit TableWindow(QWidget *parent = nullptr); explicit TableWindow(QWidget *parent = nullptr);
~TableWindow(); ~TableWindow();
public slots: public slots:
/**
* @brief ModelChosen show window when user want create new layout.
* @param listDetails list of details.
* @param description pattern description.
*/
void ModelChosen(QVector<VItem*> listDetails, const QString &fileName, const QString &description); void ModelChosen(QVector<VItem*> listDetails, const QString &fileName, const QString &description);
/**
* @brief StopTable stop creation layout.
*/
void StopTable(); void StopTable();
/**
* @brief saveScene save created layout.
*/
void saveScene(); void saveScene();
/**
* @brief GetNextDetail put next detail on table.
*/
void GetNextDetail(); void GetNextDetail();
/**
* @brief itemChect turn off rotation button if don't selected detail.
* @param flag true - enable button.
*/
void itemChect(bool flag); void itemChect(bool flag);
/**
* @brief itemOut handled if detail moved out paper sheet.
* @param number Number detail in list.
* @param flag set state of detail. True if detail moved out paper sheet.
*/
void itemOut(int number, bool flag); void itemOut(int number, bool flag);
/**
* @brief itemColliding handled if we have colission details.
* @param list list of colission details.
* @param number 0 - include to list of colission dcetails, 1 - exclude from list.
*/
void itemColliding(QList<QGraphicsItem *> list, int number); void itemColliding(QList<QGraphicsItem *> list, int number);
/**
* @brief AddLength Add length paper sheet.Збільшує довжину листа на певне значення за один раз.
*/
void AddLength(); void AddLength();
/**
* @brief RemoveLength reduce the length of paper sheet. You can reduce to the minimal value only.
*/
void RemoveLength(); void RemoveLength();
signals: signals:
/** /**
@ -113,121 +82,63 @@ signals:
*/ */
void LengthChanged(); void LengthChanged();
protected: protected:
/**
* @brief closeEvent handle after close window.
* @param event close event.
*/
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
/**
* @brief moveToCenter move screen to the center of window.
*/
void moveToCenter(); void moveToCenter();
/**
* @brief showEvent handle after show window.
* @param event show event.
*/
void showEvent ( QShowEvent * event ); void showEvent ( QShowEvent * event );
/**
* @brief keyPressEvent handle key press events.
* @param event key event.
*/
void keyPressEvent ( QKeyEvent * event ); void keyPressEvent ( QKeyEvent * event );
private: private:
Q_DISABLE_COPY(TableWindow) Q_DISABLE_COPY(TableWindow)
/** /** @brief ui keeps information about user interface */
* @brief ui keeps information about user interface Змінна для доступу до об'єктів вікна.
*/
Ui::TableWindow* ui; Ui::TableWindow* ui;
/**
* @brief listDetails list of details. /** @brief listDetails list of details. */
*/
QVector<VItem*> listDetails; QVector<VItem*> listDetails;
/**
* @brief outItems true if we have details out paper sheet. /** @brief outItems true if we have details out paper sheet. */
*/
bool outItems; bool outItems;
/**
* @brief collidingItems true if we have colission details. /** @brief collidingItems true if we have colission details. */
*/
bool collidingItems; bool collidingItems;
/**
* @brief currentScene pointer to scene. /** @brief currentScene pointer to scene. */
*/
QGraphicsScene* tableScene; QGraphicsScene* tableScene;
/**
* @brief paper paper sheet. /** @brief paper paper sheet. */
*/
QGraphicsRectItem* paper; QGraphicsRectItem* paper;
/**
* @brief shadowPaper paper sheet shadow. /** @brief shadowPaper paper sheet shadow. */
*/
QGraphicsRectItem* shadowPaper; QGraphicsRectItem* shadowPaper;
/**
* @brief checkNext disable next detail button if exist colission or out details. /** @brief listOutItems list state out each detail. */
*/
void checkNext();
/**
* @brief listOutItems list state out each detail.
*/
QBitArray* listOutItems; QBitArray* listOutItems;
/**
* @brief listCollidingItems list colissed details. /** @brief listCollidingItems list colissed details. */
*/
QList<QGraphicsItem*> listCollidingItems; QList<QGraphicsItem*> listCollidingItems;
/**
* @brief AddPaper add to the scene paper and shadow. /** @brief indexDetail index next detail in list what will be shown. */
*/
void AddPaper();
/**
* @brief AddDetail show on scene next detail.
*/
void AddDetail();
/**
* @brief indexDetail index next detail in list what will be shown.
*/
qint32 indexDetail; qint32 indexDetail;
/**
* @brief sceneRect minimal size of a paper. /** @brief sceneRect minimal size of a paper. */
*/
QRectF sceneRect; QRectF sceneRect;
/**
* @brief fileName keep name of pattern file. /** @brief fileName keep name of pattern file. */
*/
QString fileName; QString fileName;
/**
* @brief description pattern description /** @brief description pattern description */
*/
QString description; QString description;
/**
* @brief SvgFile save layout to svg file. void checkNext();
* @param name name layout file. void AddPaper();
*/ void AddDetail();
void SvgFile(const QString &name)const; void SvgFile(const QString &name)const;
/**
* @brief PngFile save layout to png file.
* @param name name layout file.
*/
void PngFile(const QString &name)const; void PngFile(const QString &name)const;
/**
* @brief PdfFile save layout to pdf file.
* @param name name layout file.
*/
void PdfFile(const QString &name)const; void PdfFile(const QString &name)const;
/**
* @brief EpsFile save layout to eps file.
* @param name name layout file.
*/
void EpsFile(const QString &name)const; void EpsFile(const QString &name)const;
/**
* @brief PsFile save layout to ps file.
* @param name name layout file.
*/
void PsFile(const QString &name)const; void PsFile(const QString &name)const;
/**
* @brief PdfToPs use external tool "pdftops" for converting pdf too eps or ps format.
* @param params string with parameter for tool. Parameters have format: "-eps input_file out_file". Use -eps when
* need create eps file.
*/
void PdfToPs(const QStringList &params)const; void PdfToPs(const QStringList &params)const;
}; };

View File

@ -39,12 +39,19 @@ VAbstractSpline::VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QG
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VAbstractSpline::FullUpdateFromFile() void VAbstractSpline::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
void VAbstractSpline::ChangedActivDraw(const QString &newName) void VAbstractSpline::ChangedActivDraw(const QString &newName)
{ {
bool selectable = false; bool selectable = false;
@ -66,12 +73,22 @@ void VAbstractSpline::ChangedActivDraw(const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowTool highlight tool.
* @param id object id in container
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void VAbstractSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) void VAbstractSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
ShowItem(this, id, color, enable); ShowItem(this, id, color, enable);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VAbstractSpline::SetFactor(qreal factor) void VAbstractSpline::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -79,6 +96,10 @@ void VAbstractSpline::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
@ -87,6 +108,10 @@ void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
@ -95,6 +120,12 @@ void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemChange hadle item change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == QGraphicsItem::ItemSelectedChange) if (change == QGraphicsItem::ItemSelectedChange)
@ -114,6 +145,10 @@ QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, c
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief keyReleaseEvent handle key release events.
* @param event key release event.
*/
void VAbstractSpline::keyReleaseEvent(QKeyEvent *event) void VAbstractSpline::keyReleaseEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())

View File

@ -40,9 +40,6 @@ public:
VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr); VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr);
static const QString TagName; static const QString TagName;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile (); virtual void FullUpdateFromFile ();
signals: signals:
/** /**
@ -68,44 +65,12 @@ protected:
* @brief RefreshGeometry refresh item on scene. * @brief RefreshGeometry refresh item on scene.
*/ */
virtual void RefreshGeometry ()=0; virtual void RefreshGeometry ()=0;
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
virtual void ChangedActivDraw ( const QString &newName ); virtual void ChangedActivDraw ( const QString &newName );
/**
* @brief ShowTool highlight tool.
* @param id object id in container
* @param color highlight color.
* @param enable enable or disable highlight.
*/
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief itemChange hadle item change.
* @param change change.
* @param value value.
* @return value.
*/
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
/**
* @brief keyReleaseEvent handle key release events.
* @param event key release event.
*/
virtual void keyReleaseEvent(QKeyEvent * event); virtual void keyReleaseEvent(QKeyEvent * event);
}; };

View File

@ -147,6 +147,9 @@ void VDrawTool::SaveDialogChange()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogLinkDestroy removes dialog pointer
*/
void VDrawTool::DialogLinkDestroy() void VDrawTool::DialogLinkDestroy()
{ {
this->dialog=nullptr; this->dialog=nullptr;

View File

@ -50,11 +50,7 @@ public:
/** @brief setDialog set dialog when user want change tool option. */ /** @brief setDialog set dialog when user want change tool option. */
virtual void setDialog() {} virtual void setDialog() {}
/**
* @brief DialogLinkDestroy removes dialog pointer
*/
virtual void DialogLinkDestroy(); virtual void DialogLinkDestroy();
void ignoreContextMenu(bool enable); void ignoreContextMenu(bool enable);
static qreal CheckFormula(QString &formula, VContainer *data); static qreal CheckFormula(QString &formula, VContainer *data);
public slots: public slots:

View File

@ -35,6 +35,18 @@
const QString VToolAlongLine::ToolType = QStringLiteral("alongLine"); const QString VToolAlongLine::ToolType = QStringLiteral("alongLine");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolAlongLine constuctor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param formula string with length formula.
* @param firstPointId id first point of line.
* @param secondPointId id second point of line.
* @param typeLine line type. line type.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula, VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula,
const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &firstPointId, const quint32 &secondPointId,
const QString &typeLine, const Source &typeCreation, const QString &typeLine, const Source &typeCreation,
@ -53,6 +65,9 @@ VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, cons
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolAlongLine::FullUpdateFromFile() void VToolAlongLine::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -67,6 +82,10 @@ void VToolAlongLine::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolAlongLine::SetFactor(qreal factor) void VToolAlongLine::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -74,6 +93,10 @@ void VToolAlongLine::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events. handle context menu event.
* @param event context menu event.
*/
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
@ -81,12 +104,19 @@ void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu handle context menu event.
* @param event context menu event.
*/
void VToolAlongLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolAlongLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogAlongLine>(this, event); ContextMenu<DialogAlongLine>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolAlongLine::AddToFile() void VToolAlongLine::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -107,6 +137,9 @@ void VToolAlongLine::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolAlongLine::RefreshDataInFile() void VToolAlongLine::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -124,6 +157,9 @@ void VToolAlongLine::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolAlongLine::RemoveReferens() void VToolAlongLine::RemoveReferens()
{ {
doc->DecrementReferens(secondPointId); doc->DecrementReferens(secondPointId);
@ -131,6 +167,9 @@ void VToolAlongLine::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolAlongLine::SaveDialog(QDomElement &domElement) void VToolAlongLine::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -144,6 +183,9 @@ void VToolAlongLine::SaveDialog(QDomElement &domElement)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolAlongLine::setDialog() void VToolAlongLine::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -158,6 +200,13 @@ void VToolAlongLine::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool form GUI.
* @param dialog dialog options.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -179,10 +228,26 @@ VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *s
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, QString &formula, /**
const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, * @brief Create help create tool.
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, * @param _id tool id, 0 if tool doesn't exist yet.
const Document &parse, const Source &typeCreation) * @param pointName point name. point name.
* @param typeLine line type.
* @param formula string with length formula.
* @param firstPointId id first point of line.
* @param secondPointId id second point of line.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{ {
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId); const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId); const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);

View File

@ -38,95 +38,29 @@ class VToolAlongLine : public VToolLinePoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolAlongLine constuctor. VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula, const quint32 &firstPointId,
* @param doc dom document container. const quint32 &secondPointId, const QString &typeLine, const Source &typeCreation,
* @param data container with variables. QGraphicsItem * parent = nullptr);
* @param id object id in container.
* @param formula string with length formula.
* @param firstPointId id first point of line.
* @param secondPointId id second point of line.
* @param typeLine line type. line type.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula,
const quint32 &firstPointId, const quint32 &secondPointId, const QString &typeLine,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool form GUI.
* @param dialog dialog options.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static VToolAlongLine* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static VToolAlongLine* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/** static VToolAlongLine* Create(const quint32 _id, const QString &pointName, const QString &typeLine,
* @brief Create help create tool. QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
* @param _id tool id, 0 if tool doesn't exist yet. const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
* @param pointName point name. point name. VContainer *data, const Document &parse, const Source &typeCreation);
* @param typeLine line type.
* @param formula string with length formula.
* @param firstPointId id first point of line.
* @param secondPointId id second point of line.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static VToolAlongLine* Create(const quint32 _id, const QString &pointName, const QString &typeLine, QString &formula,
const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
/**
* @brief ShowContextMenu handle context menu event.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events. handle context menu event.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/** /** @brief secondPointId id second point of line. */
* @brief secondPointId id second point of line.
*/
quint32 secondPointId; quint32 secondPointId;
}; };

View File

@ -36,6 +36,14 @@ const QString VToolArc::TagName = QStringLiteral("arc");
const QString VToolArc::ToolType = QStringLiteral("simple"); const QString VToolArc::ToolType = QStringLiteral("simple");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolArc constuctor.
* @param doc dom document container
* @param data container with variables
* @param id object id in container
* @param typeCreation way we create this tool.
* @param parent parent object
*/
VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem *parent) QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsPathItem(parent) :VDrawTool(doc, data, id), QGraphicsPathItem(parent)
@ -61,6 +69,9 @@ VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Source &ty
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolArc::setDialog() void VToolArc::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -74,6 +85,13 @@ void VToolArc::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool
* @param dialog dialog options.
* @param scene pointer to scene.
* @param doc dom document container
* @param data container with variables
*/
VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -93,6 +111,19 @@ VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatte
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool form GUI.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param center id arc center point.
* @param radius arc radius.
* @param f1 start angle of arc.
* @param f2 end angle of arc.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2, VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation) const Source &typeCreation)
@ -134,12 +165,19 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolArc::FullUpdateFromFile() void VToolArc::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
void VToolArc::ChangedActivDraw(const QString &newName) void VToolArc::ChangedActivDraw(const QString &newName)
{ {
bool selectable = false; bool selectable = false;
@ -160,12 +198,22 @@ void VToolArc::ChangedActivDraw(const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowTool highlight tool.
* @param id object id in container
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void VToolArc::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) void VToolArc::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
ShowItem(this, id, color, enable); ShowItem(this, id, color, enable);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolArc::SetFactor(qreal factor) void VToolArc::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -173,12 +221,19 @@ void VToolArc::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogArc>(this, event); ContextMenu<DialogArc>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolArc::AddToFile() void VToolArc::AddToFile()
{ {
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
@ -195,6 +250,9 @@ void VToolArc::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolArc::RefreshDataInFile() void VToolArc::RefreshDataInFile()
{ {
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
@ -209,6 +267,10 @@ void VToolArc::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -219,6 +281,10 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
@ -227,6 +293,10 @@ void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
@ -235,6 +305,9 @@ void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolArc::RemoveReferens() void VToolArc::RemoveReferens()
{ {
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
@ -242,6 +315,12 @@ void VToolArc::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemChange handle tool change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant VToolArc::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VToolArc::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == QGraphicsItem::ItemSelectedChange) if (change == QGraphicsItem::ItemSelectedChange)
@ -261,6 +340,10 @@ QVariant VToolArc::itemChange(QGraphicsItem::GraphicsItemChange change, const QV
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief keyReleaseEvent handle key release events.
* @param event key release event.
*/
void VToolArc::keyReleaseEvent(QKeyEvent *event) void VToolArc::keyReleaseEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())
@ -275,6 +358,9 @@ void VToolArc::keyReleaseEvent(QKeyEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolArc::SaveDialog(QDomElement &domElement) void VToolArc::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -287,6 +373,9 @@ void VToolArc::SaveDialog(QDomElement &domElement)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolArc::RefreshGeometry() void VToolArc::RefreshGeometry()
{ {
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));

View File

@ -40,121 +40,31 @@ class VToolArc :public VDrawTool, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** VToolArc(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem * parent = nullptr);
* @brief VToolArc constuctor.
* @param doc dom document container
* @param data container with variables
* @param id object id in container
* @param typeCreation way we create this tool.
* @param parent parent object
*/
VToolArc(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool
* @param dialog dialog options.
* @param scene pointer to scene.
* @param doc dom document container
* @param data container with variables
*/
static VToolArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static VToolArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool form GUI.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param center id arc center point.
* @param radius arc radius.
* @param f1 start angle of arc.
* @param f2 end angle of arc.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static VToolArc* Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2, static VToolArc* Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation); const Source &typeCreation);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
/**
* @brief ShowTool highlight tool.
* @param id object id in container
* @param color highlight color.
* @param enable enable or disable highlight.
*/
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief itemChange handle tool change.
* @param change change.
* @param value value.
* @return value.
*/
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
/**
* @brief keyReleaseEvent handle key release events.
* @param event key release event.
*/
virtual void keyReleaseEvent(QKeyEvent * event); virtual void keyReleaseEvent(QKeyEvent * event);
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/**
* @brief RefreshGeometry refresh item on scene.
*/
void RefreshGeometry(); void RefreshGeometry();
}; };

View File

@ -34,6 +34,19 @@
const QString VToolBisector::ToolType = QStringLiteral("bisector"); const QString VToolBisector::ToolType = QStringLiteral("bisector");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolBisector constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeLine line type.
* @param formula string with formula length of bisector.
* @param firstPointId id first point of angle.
* @param secondPointId id second point of angle.
* @param thirdPointId id third point of angle.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const quint32 &thirdPointId, const Source &typeCreation, QGraphicsItem *parent) const quint32 &thirdPointId, const Source &typeCreation, QGraphicsItem *parent)
@ -53,6 +66,14 @@ VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FindPoint find bisector point.
* @param firstPoint first point of angle.
* @param secondPoint second point of angle.
* @param thirdPoint third point of angle.
* @param length bisector length.
* @return bisector point.
*/
QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint,
const QPointF &thirdPoint, const qreal &length) const QPointF &thirdPoint, const qreal &length)
{ {
@ -73,6 +94,9 @@ QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secon
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolBisector::setDialog() void VToolBisector::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -88,6 +112,13 @@ void VToolBisector::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool form GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data) VContainer *data)
{ {
@ -111,6 +142,23 @@ VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *sce
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param formula string with formula.
* @param firstPointId id first point of angle.
* @param secondPointId id second point of angle.
* @param thirdPointId id third point of angle.
* @param typeLine line type.
* @param pointName point name.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const quint32 &firstPointId, VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine, const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, const QString &pointName, const qreal &mx, const qreal &my,
@ -158,6 +206,9 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolBisector::FullUpdateFromFile() void VToolBisector::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -173,6 +224,10 @@ void VToolBisector::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolBisector::SetFactor(qreal factor) void VToolBisector::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -180,18 +235,29 @@ void VToolBisector::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolBisector::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolBisector::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogBisector>(this, event); ContextMenu<DialogBisector>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogBisector>(this, event); ContextMenu<DialogBisector>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolBisector::AddToFile() void VToolBisector::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -213,6 +279,9 @@ void VToolBisector::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolBisector::RefreshDataInFile() void VToolBisector::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -231,6 +300,9 @@ void VToolBisector::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolBisector::RemoveReferens() void VToolBisector::RemoveReferens()
{ {
doc->DecrementReferens(firstPointId); doc->DecrementReferens(firstPointId);
@ -239,6 +311,9 @@ void VToolBisector::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolBisector::SaveDialog(QDomElement &domElement) void VToolBisector::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);

View File

@ -37,62 +37,14 @@
class VToolBisector : public VToolLinePoint class VToolBisector : public VToolLinePoint
{ {
public: public:
/**
* @brief VToolBisector constructor. VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
* @param doc dom document container. const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &thirdPointId,
* @param data container with variables. const Source &typeCreation, QGraphicsItem * parent = nullptr);
* @param id object id in container.
* @param typeLine line type.
* @param formula string with formula length of bisector.
* @param firstPointId id first point of angle.
* @param secondPointId id second point of angle.
* @param thirdPointId id third point of angle.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const quint32 &thirdPointId, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
/**
* @brief FindPoint find bisector point.
* @param firstPoint first point of angle.
* @param secondPoint second point of angle.
* @param thirdPoint third point of angle.
* @param length bisector length.
* @return bisector point.
*/
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint, static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint,
const qreal& length); const qreal& length);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool form GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static VToolBisector* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static VToolBisector* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param formula string with formula.
* @param firstPointId id first point of angle.
* @param secondPointId id second point of angle.
* @param thirdPointId id third point of angle.
* @param typeLine line type.
* @param pointName point name.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static VToolBisector* Create(const quint32 _id, QString &formula, const quint32 &firstPointId, static VToolBisector* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine, const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
@ -100,50 +52,20 @@ public:
const Source &typeCreation); const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/** /** @brief firstPointId id first point of angle. */
* @brief firstPointId id first point of angle.
*/
quint32 firstPointId; quint32 firstPointId;
/**
* @brief thirdPointId id third point of angle. /** @brief thirdPointId id third point of angle. */
*/
quint32 thirdPointId; quint32 thirdPointId;
}; };

View File

@ -36,6 +36,18 @@ const QString VToolCutArc::ToolType = QStringLiteral("cutArc");
const QString VToolCutArc::AttrArc = QStringLiteral("arc"); const QString VToolCutArc::AttrArc = QStringLiteral("arc");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolCutArc constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param formula string with formula length first arc.
* @param arcId id arc in data container.
* @param arc1id id first cutting arc.
* @param arc2id id second cutting arc.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id, const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id,
const Source &typeCreation, QGraphicsItem * parent) const Source &typeCreation, QGraphicsItem * parent)
@ -67,6 +79,9 @@ VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, con
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolCutArc::setDialog() void VToolCutArc::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -79,8 +94,14 @@ void VToolCutArc::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, /**
VContainer *data) * @brief Create help create tool form GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog); DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
@ -98,6 +119,20 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param formula string with formula length first arc.
* @param arcId id arc in data container.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId, VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation) VContainer *data, const Document &parse, const Source &typeCreation)
@ -163,6 +198,9 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolCutArc::FullUpdateFromFile() void VToolCutArc::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -175,12 +213,20 @@ void VToolCutArc::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ArcChoosed send signal about selection from cutted arc.
* @param id object id in container.
*/
void VToolCutArc::ArcChoosed(quint32 id) void VToolCutArc::ArcChoosed(quint32 id)
{ {
emit ChoosedTool(id, SceneObject::Arc); emit ChoosedTool(id, SceneObject::Arc);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
void VToolCutArc::ChangedActivDraw(const QString &newName) void VToolCutArc::ChangedActivDraw(const QString &newName)
{ {
if (nameActivDraw == newName) if (nameActivDraw == newName)
@ -205,18 +251,29 @@ void VToolCutArc::ChangedActivDraw(const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolCutArc::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolCutArc::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutArc>(this, event); ContextMenu<DialogCutArc>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolCutArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolCutArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutArc>(this, event); ContextMenu<DialogCutArc>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolCutArc::AddToFile() void VToolCutArc::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -235,6 +292,9 @@ void VToolCutArc::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolCutArc::RefreshDataInFile() void VToolCutArc::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -250,6 +310,9 @@ void VToolCutArc::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolCutArc::RefreshGeometry() void VToolCutArc::RefreshGeometry()
{ {
RefreshArc(firstArc, arc1id, SimpleArcPoint::ForthPoint); RefreshArc(firstArc, arc1id, SimpleArcPoint::ForthPoint);
@ -258,6 +321,9 @@ void VToolCutArc::RefreshGeometry()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolCutArc::SaveDialog(QDomElement &domElement) void VToolCutArc::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -269,6 +335,12 @@ void VToolCutArc::SaveDialog(QDomElement &domElement)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshArc refresh arc on scene.
* @param sArc arc.
* @param arcid arc id.
* @param tr arc type.
*/
void VToolCutArc::RefreshArc(VSimpleArc *sArc, quint32 arcid, SimpleArcPoint tr) void VToolCutArc::RefreshArc(VSimpleArc *sArc, quint32 arcid, SimpleArcPoint tr)
{ {
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(arcid); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(arcid);

View File

@ -39,126 +39,47 @@ class VToolCutArc : public VToolPoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/** VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &arcId,
* @brief VToolCutArc constructor. const quint32 &arc1id, const quint32 &arc2id, const Source &typeCreation,
* @param doc dom document container. QGraphicsItem * parent = nullptr);
* @param data container with variables.
* @param id object id in container.
* @param formula string with formula length first arc.
* @param arcId id arc in data container.
* @param arc1id id first cutting arc.
* @param arc2id id second cutting arc.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool form GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param formula string with formula length first arc.
* @param arcId id arc in data container.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId, static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
static const QString AttrArc; static const QString AttrArc;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief ArcChoosed send signal about selection from cutted arc.
* @param id object id in container.
*/
void ArcChoosed(quint32 id); void ArcChoosed(quint32 id);
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief RefreshGeometry refresh item on scene.
*/
void RefreshGeometry(); void RefreshGeometry();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
Q_DISABLE_COPY(VToolCutArc) Q_DISABLE_COPY(VToolCutArc)
/**
* @brief formula keep formula of length /** @brief formula keep formula of length */
*/
QString formula; QString formula;
/**
* @brief arcId keep id of arc /** @brief arcId keep id of arc */
*/
quint32 arcId; quint32 arcId;
/**
* @brief firstArc first arc after cutting. /** @brief firstArc first arc after cutting. */
*/
VSimpleArc *firstArc; VSimpleArc *firstArc;
/**
* @brief secondArc second arc after cutting. /** @brief secondArc second arc after cutting. */
*/
VSimpleArc *secondArc; VSimpleArc *secondArc;
/**
* @brief arc1id id first arc after cutting. /** @brief arc1id id first arc after cutting. */
*/
const quint32 arc1id; const quint32 arc1id;
/**
* @brief arc2id id second arc after cutting. /** @brief arc2id id second arc after cutting. */
*/
const quint32 arc2id; const quint32 arc2id;
/**
* @brief RefreshArc refresh arc on scene.
* @param sArc arc.
* @param arcid arc id.
* @param tr arc type.
*/
void RefreshArc(VSimpleArc *sArc, quint32 arcid, SimpleArcPoint tr); void RefreshArc(VSimpleArc *sArc, quint32 arcid, SimpleArcPoint tr);
}; };

View File

@ -37,6 +37,16 @@ const QString VToolCutSpline::ToolType = QStringLiteral("cutSpline");
const QString VToolCutSpline::AttrSpline = QStringLiteral("spline"); const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolCutSpline constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param formula string with formula length first spline.
* @param splineId id spline in data container.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
const Source &typeCreation, QGraphicsItem *parent) const Source &typeCreation, QGraphicsItem *parent)
@ -68,6 +78,9 @@ VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &i
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolCutSpline::setDialog() void VToolCutSpline::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -80,6 +93,13 @@ void VToolCutSpline::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data) VPattern *doc, VContainer *data)
{ {
@ -93,6 +113,20 @@ void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param formula string with formula length first spline.
* @param splineId id spline in data container.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splineId, void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation) VContainer *data, const Document &parse, const Source &typeCreation)
@ -156,6 +190,9 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolCutSpline::FullUpdateFromFile() void VToolCutSpline::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -168,12 +205,20 @@ void VToolCutSpline::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SplineChoosed send signal about selection from spline.
* @param id object id in container.
*/
void VToolCutSpline::SplineChoosed(quint32 id) void VToolCutSpline::SplineChoosed(quint32 id)
{ {
emit ChoosedTool(id, SceneObject::Spline); emit ChoosedTool(id, SceneObject::Spline);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
void VToolCutSpline::ChangedActivDraw(const QString &newName) void VToolCutSpline::ChangedActivDraw(const QString &newName)
{ {
bool flag = true; bool flag = true;
@ -193,18 +238,29 @@ void VToolCutSpline::ChangedActivDraw(const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolCutSpline::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolCutSpline::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutSpline>(this, event); ContextMenu<DialogCutSpline>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutSpline>(this, event); ContextMenu<DialogCutSpline>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolCutSpline::AddToFile() void VToolCutSpline::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -223,6 +279,9 @@ void VToolCutSpline::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolCutSpline::RefreshDataInFile() void VToolCutSpline::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -238,6 +297,9 @@ void VToolCutSpline::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolCutSpline::RefreshGeometry() void VToolCutSpline::RefreshGeometry()
{ {
RefreshSpline(firstSpline, spl1id, SimpleSplinePoint::ForthPoint); RefreshSpline(firstSpline, spl1id, SimpleSplinePoint::ForthPoint);
@ -246,12 +308,18 @@ void VToolCutSpline::RefreshGeometry()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement referens value for used objects.
*/
void VToolCutSpline::RemoveReferens() void VToolCutSpline::RemoveReferens()
{ {
doc->DecrementReferens(splineId); doc->DecrementReferens(splineId);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolCutSpline::SaveDialog(QDomElement &domElement) void VToolCutSpline::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -263,6 +331,12 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshSpline refresh spline on scene.
* @param spline spline.
* @param splid spline id.
* @param tr spline type.
*/
void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, quint32 splid, SimpleSplinePoint tr) void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, quint32 splid, SimpleSplinePoint tr)
{ {
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(splid); const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(splid);

View File

@ -39,128 +39,50 @@ class VToolCutSpline : public VToolPoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolCutSpline constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param formula string with formula length first spline.
* @param splineId id spline in data container.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
const Source &typeCreation, QGraphicsItem * parent = nullptr); const Source &typeCreation, QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param formula string with formula length first spline.
* @param splineId id spline in data container.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splineId, static void Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
static const QString AttrSpline; static const QString AttrSpline;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief SplineChoosed send signal about selection from spline.
* @param id object id in container.
*/
void SplineChoosed(quint32 id); void SplineChoosed(quint32 id);
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief RefreshGeometry refresh item on scene.
*/
void RefreshGeometry(); void RefreshGeometry();
/**
* @brief RemoveReferens decrement referens value for used objects.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
Q_DISABLE_COPY(VToolCutSpline) Q_DISABLE_COPY(VToolCutSpline)
/**
* @brief formula keep formula of length. /** @brief formula keep formula of length. */
*/
QString formula; QString formula;
/**
* @brief splineId keep id of spline. /** @brief splineId keep id of spline. */
*/
quint32 splineId; quint32 splineId;
/**
* @brief firstSpline first spline after cutting. /** @brief firstSpline first spline after cutting. */
*/
VSimpleSpline *firstSpline; VSimpleSpline *firstSpline;
/**
* @brief secondSpline second spline after cutting. /** @brief secondSpline second spline after cutting. */
*/
VSimpleSpline *secondSpline; VSimpleSpline *secondSpline;
/**
* @brief spl1id id first spline after cutting. /** @brief spl1id id first spline after cutting. */
*/
const quint32 spl1id; const quint32 spl1id;
/**
* @brief spl2id id second spline after cutting. /** @brief spl2id id second spline after cutting. */
*/
const quint32 spl2id; const quint32 spl2id;
/**
* @brief RefreshSpline refresh spline on scene.
* @param spline spline.
* @param splid spline id.
* @param tr spline type.
*/
void RefreshSpline(VSimpleSpline *spline, quint32 splid, SimpleSplinePoint tr); void RefreshSpline(VSimpleSpline *spline, quint32 splid, SimpleSplinePoint tr);
}; };

View File

@ -37,6 +37,18 @@ const QString VToolCutSplinePath::ToolType = QStringLiteral("cutSplinePath");
const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath"); const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolCutSplinePath constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param formula string with formula length first splinePath.
* @param splinePathId id splinePath (we cut this splinePath) in data container.
* @param splPath1id id first splinePath after cutting.
* @param splPath2id id second splinePath after cutting.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id,
const QString &formula, const quint32 &splinePathId, const QString &formula, const quint32 &splinePathId,
const quint32 &splPath1id, const quint32 &splPath2id, const quint32 &splPath1id, const quint32 &splPath2id,
@ -69,6 +81,9 @@ VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qu
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolCutSplinePath::setDialog() void VToolCutSplinePath::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -81,6 +96,13 @@ void VToolCutSplinePath::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool form GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -93,6 +115,20 @@ void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param formula string with formula length first splinePath.
* @param splinePathId id of splinePath in data container.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QString &formula, void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splinePathId, const qreal &mx, const qreal &my, const quint32 &splinePathId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@ -231,6 +267,9 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolCutSplinePath::FullUpdateFromFile() void VToolCutSplinePath::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -243,12 +282,20 @@ void VToolCutSplinePath::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SplineChoosed send signal about selection splinePath.
* @param id object id in container.
*/
void VToolCutSplinePath::SplineChoosed(quint32 id) void VToolCutSplinePath::SplineChoosed(quint32 id)
{ {
emit ChoosedTool(id, SceneObject::SplinePath); emit ChoosedTool(id, SceneObject::SplinePath);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
void VToolCutSplinePath::ChangedActivDraw(const QString &newName) void VToolCutSplinePath::ChangedActivDraw(const QString &newName)
{ {
bool flag = true; bool flag = true;
@ -268,18 +315,29 @@ void VToolCutSplinePath::ChangedActivDraw(const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolCutSplinePath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolCutSplinePath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutSplinePath>(this, event); ContextMenu<DialogCutSplinePath>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutSplinePath>(this, event); ContextMenu<DialogCutSplinePath>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolCutSplinePath::AddToFile() void VToolCutSplinePath::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -298,6 +356,9 @@ void VToolCutSplinePath::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolCutSplinePath::RefreshDataInFile() void VToolCutSplinePath::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -313,6 +374,9 @@ void VToolCutSplinePath::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolCutSplinePath::RefreshGeometry() void VToolCutSplinePath::RefreshGeometry()
{ {
RefreshSpline(firstSpline, splPath1id, SimpleSplinePoint::ForthPoint); RefreshSpline(firstSpline, splPath1id, SimpleSplinePoint::ForthPoint);
@ -321,12 +385,18 @@ void VToolCutSplinePath::RefreshGeometry()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement referens value for used objects.
*/
void VToolCutSplinePath::RemoveReferens() void VToolCutSplinePath::RemoveReferens()
{ {
doc->DecrementReferens(splinePathId); doc->DecrementReferens(splinePathId);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolCutSplinePath::SaveDialog(QDomElement &domElement) void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -338,6 +408,12 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshSpline refresh splinePath on scene.
* @param spline splinePath.
* @param splPathid splinePath id.
* @param tr splineType type.
*/
void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, quint32 splPathid, SimpleSplinePoint tr) void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, quint32 splPathid, SimpleSplinePoint tr)
{ {
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(splPathid); const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(splPathid);

View File

@ -40,130 +40,50 @@ class VToolCutSplinePath : public VToolPoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolCutSplinePath constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param formula string with formula length first splinePath.
* @param splinePathId id splinePath (we cut this splinePath) in data container.
* @param splPath1id id first splinePath after cutting.
* @param splPath2id id second splinePath after cutting.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id, const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id,
const Source &typeCreation, QGraphicsItem * parent = nullptr); const Source &typeCreation, QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool form GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param formula string with formula length first splinePath.
* @param splinePathId id of splinePath in data container.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splinePathId, static void Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splinePathId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
static const QString AttrSplinePath; static const QString AttrSplinePath;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief SplineChoosed send signal about selection splinePath.
* @param id object id in container.
*/
void SplineChoosed(quint32 id); void SplineChoosed(quint32 id);
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief RefreshGeometry refresh item on scene.
*/
void RefreshGeometry(); void RefreshGeometry();
/**
* @brief RemoveReferens decrement referens value for used objects.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
Q_DISABLE_COPY(VToolCutSplinePath) Q_DISABLE_COPY(VToolCutSplinePath)
/**
* @brief formula keep formula of length /** @brief formula keep formula of length */
*/
QString formula; QString formula;
/**
* @brief splineId keep id of spline. /** @brief splineId keep id of spline. */
*/
quint32 splinePathId; quint32 splinePathId;
/**
* @brief firstSpline first splinePath after cutting. /** @brief firstSpline first splinePath after cutting. */
*/
VSimpleSpline *firstSpline; VSimpleSpline *firstSpline;
/**
* @brief secondSpline second splinePath after cutting. /** @brief secondSpline second splinePath after cutting. */
*/
VSimpleSpline *secondSpline; VSimpleSpline *secondSpline;
/**
* @brief splPath1id id first splinePath after cutting. /** @brief splPath1id id first splinePath after cutting. */
*/
const quint32 splPath1id; const quint32 splPath1id;
/**
* @brief splPath2id id second splinePath after cutting. /** @brief splPath2id id second splinePath after cutting. */
*/
const quint32 splPath2id; const quint32 splPath2id;
/**
* @brief RefreshSpline refresh splinePath on scene.
* @param spline splinePath.
* @param splPathid splinePath id.
* @param tr splineType type.
*/
void RefreshSpline(VSimpleSpline *spline, quint32 splPathid, SimpleSplinePoint tr); void RefreshSpline(VSimpleSpline *spline, quint32 splPathid, SimpleSplinePoint tr);
}; };

View File

@ -36,6 +36,18 @@
const QString VToolEndLine::ToolType = QStringLiteral("endLine"); const QString VToolEndLine::ToolType = QStringLiteral("endLine");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolEndLine constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeLine line type.
* @param formula string with formula length of line.
* @param angle angle of line.
* @param basePointId id first point of line.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const quint32 &basePointId, const QString &formula, const qreal &angle, const quint32 &basePointId,
const Source &typeCreation, QGraphicsItem *parent) const Source &typeCreation, QGraphicsItem *parent)
@ -53,6 +65,9 @@ VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolEndLine::setDialog() void VToolEndLine::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -67,6 +82,14 @@ void VToolEndLine::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @return the created tool
*/
VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -89,6 +112,23 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param typeLine line type.
* @param formula string with formula length of line.
* @param angle angle of line.
* @param basePointId id first point of line.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @return the created tool
*/
VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
QString &formula, const qreal &angle, const quint32 &basePointId, QString &formula, const qreal &angle, const quint32 &basePointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
@ -130,6 +170,9 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolEndLine::FullUpdateFromFile() void VToolEndLine::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -144,18 +187,29 @@ void VToolEndLine::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogEndLine>(this, event); ContextMenu<DialogEndLine>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolEndLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolEndLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogEndLine>(this, event); ContextMenu<DialogEndLine>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolEndLine::AddToFile() void VToolEndLine::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -176,6 +230,9 @@ void VToolEndLine::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolEndLine::RefreshDataInFile() void VToolEndLine::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -193,6 +250,9 @@ void VToolEndLine::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolEndLine::SaveDialog(QDomElement &domElement) void VToolEndLine::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);

View File

@ -38,83 +38,24 @@ class VToolEndLine : public VToolLinePoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolEndLine constructor. VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
* @param doc dom document container. const qreal &angle, const quint32 &basePointId, const Source &typeCreation,
* @param data container with variables. QGraphicsItem * parent = nullptr);
* @param id object id in container.
* @param typeLine line type.
* @param formula string with formula length of line.
* @param angle angle of line.
* @param basePointId id first point of line.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const quint32 &basePointId,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @return the created tool
*/
static VToolEndLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static VToolEndLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/** static VToolEndLine *Create(const quint32 _id, const QString &pointName, const QString &typeLine, QString &formula,
* @brief Create help create tool. const qreal &angle, const quint32 &basePointId, const qreal &mx, const qreal &my,
* @param _id tool id, 0 if tool doesn't exist yet. VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
* @param pointName point name. const Source &typeCreation);
* @param typeLine line type.
* @param formula string with formula length of line.
* @param angle angle of line.
* @param basePointId id first point of line.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @return the created tool
*/
static VToolEndLine *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
QString &formula, const qreal &angle, const quint32 &basePointId, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
}; };

View File

@ -33,6 +33,18 @@
const QString VToolHeight::ToolType = QStringLiteral("height"); const QString VToolHeight::ToolType = QStringLiteral("height");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolHeight constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeLine line type.
* @param basePointId id base point of projection.
* @param p1LineId id first point of line.
* @param p2LineId id second point of line.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const Source &typeCreation, QGraphicsItem * parent) const Source &typeCreation, QGraphicsItem * parent)
@ -50,6 +62,9 @@ VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, con
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolHeight::setDialog() void VToolHeight::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -64,6 +79,13 @@ void VToolHeight::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data) VContainer *data)
{ {
@ -81,6 +103,22 @@ void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param typeLine line type.
* @param basePointId id base point of projection.
* @param p1LineId id first point of line.
* @param p2LineId id second point of line.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
void VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine, void VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
@ -126,12 +164,21 @@ void VToolHeight::Create(const quint32 _id, const QString &pointName, const QStr
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FindPoint find projection base point onto line.
* @param line line
* @param point base point.
* @return point onto line.
*/
QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point) QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point)
{ {
return VAbstractTool::ClosestPoint(line, point); return VAbstractTool::ClosestPoint(line, point);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolHeight::FullUpdateFromFile() void VToolHeight::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -147,18 +194,29 @@ void VToolHeight::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolHeight::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolHeight::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogHeight>(this, event); ContextMenu<DialogHeight>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogHeight>(this, event); ContextMenu<DialogHeight>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolHeight::AddToFile() void VToolHeight::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -180,6 +238,9 @@ void VToolHeight::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolHeight::RefreshDataInFile() void VToolHeight::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -197,6 +258,9 @@ void VToolHeight::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolHeight::SaveDialog(QDomElement &domElement) void VToolHeight::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);

View File

@ -38,97 +38,31 @@ class VToolHeight: public VToolLinePoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolHeight constructor. VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const quint32 &basePointId,
* @param doc dom document container. const quint32 &p1LineId, const quint32 &p2LineId, const Source &typeCreation,
* @param data container with variables. QGraphicsItem * parent = nullptr);
* @param id object id in container.
* @param typeLine line type.
* @param basePointId id base point of projection.
* @param p1LineId id first point of line.
* @param p2LineId id second point of line.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param typeLine line type.
* @param basePointId id base point of projection.
* @param p1LineId id first point of line.
* @param p2LineId id second point of line.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 _id, const QString &pointName, const QString &typeLine, static void Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
/**
* @brief FindPoint find projection base point onto line.
* @param line line
* @param point base point.
* @return point onto line.
*/
static QPointF FindPoint(const QLineF &line, const QPointF &point); static QPointF FindPoint(const QLineF &line, const QPointF &point);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/** /** @brief p1LineId id first point of line. */
* @brief p1LineId id first point of line.
*/
quint32 p1LineId; quint32 p1LineId;
/**
* @brief p2LineId id second point of line. /** @brief p2LineId id second point of line. */
*/
quint32 p2LineId; quint32 p2LineId;
}; };

View File

@ -35,6 +35,17 @@
const QString VToolLine::TagName = QStringLiteral("line"); const QString VToolLine::TagName = QStringLiteral("line");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolLine constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param firstPoint id first line point.
* @param secondPoint id second line point.
* @param typeLine line type.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint, VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
const QString &typeLine, const Source &typeCreation, QGraphicsItem *parent) const QString &typeLine, const Source &typeCreation, QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint) :VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint)
@ -62,6 +73,9 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolLine::setDialog() void VToolLine::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -73,6 +87,13 @@ void VToolLine::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool form GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -85,6 +106,18 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param firstPoint id first line point.
* @param secondPoint id second line point.
* @param typeLine line type.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation) const Document &parse, const Source &typeCreation)
@ -121,18 +154,31 @@ void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quin
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolLine::FullUpdateFromFile() void VToolLine::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowTool highlight tool.
* @param id object id in container
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void VToolLine::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) void VToolLine::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
ShowItem(this, id, color, enable); ShowItem(this, id, color, enable);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolLine::SetFactor(qreal factor) void VToolLine::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -140,6 +186,10 @@ void VToolLine::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
void VToolLine::ChangedActivDraw(const QString &newName) void VToolLine::ChangedActivDraw(const QString &newName)
{ {
bool selectable = false; bool selectable = false;
@ -159,12 +209,19 @@ void VToolLine::ChangedActivDraw(const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogLine>(this, event); ContextMenu<DialogLine>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolLine::AddToFile() void VToolLine::AddToFile()
{ {
QDomElement domElement = doc->createElement(TagName); QDomElement domElement = doc->createElement(TagName);
@ -177,6 +234,9 @@ void VToolLine::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolLine::RefreshDataInFile() void VToolLine::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -189,6 +249,10 @@ void VToolLine::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -196,6 +260,10 @@ void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -203,6 +271,9 @@ void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolLine::RemoveReferens() void VToolLine::RemoveReferens()
{ {
doc->DecrementReferens(firstPoint); doc->DecrementReferens(firstPoint);
@ -210,6 +281,12 @@ void VToolLine::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemChange handle item change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant VToolLine::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VToolLine::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == QGraphicsItem::ItemSelectedChange) if (change == QGraphicsItem::ItemSelectedChange)
@ -229,6 +306,10 @@ QVariant VToolLine::itemChange(QGraphicsItem::GraphicsItemChange change, const Q
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief keyReleaseEvent handle key realse events.
* @param event key realse event.
*/
void VToolLine::keyReleaseEvent(QKeyEvent *event) void VToolLine::keyReleaseEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())
@ -243,6 +324,9 @@ void VToolLine::keyReleaseEvent(QKeyEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolLine::SaveDialog(QDomElement &domElement) void VToolLine::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -254,6 +338,9 @@ void VToolLine::SaveDialog(QDomElement &domElement)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolLine::RefreshGeometry() void VToolLine::RefreshGeometry()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));

View File

@ -39,126 +39,36 @@ class VToolLine: public VDrawTool, public QGraphicsLineItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
* @brief VToolLine constructor. const QString &typeLine, const Source &typeCreation, QGraphicsItem * parent = nullptr);
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param firstPoint id first line point.
* @param secondPoint id second line point.
* @param typeLine line type.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint,
quint32 secondPoint, const QString &typeLine, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool form GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param firstPoint id first line point.
* @param secondPoint id second line point.
* @param typeLine line type.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString TagName; static const QString TagName;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
/**
* @brief ShowTool highlight tool.
* @param id object id in container
* @param color highlight color.
* @param enable enable or disable highlight.
*/
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief itemChange handle item change.
* @param change change.
* @param value value.
* @return value.
*/
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
/**
* @brief keyReleaseEvent handle key realse events.
* @param event key realse event.
*/
virtual void keyReleaseEvent(QKeyEvent * event); virtual void keyReleaseEvent(QKeyEvent * event);
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/** /** @brief firstPoint id first line point. */
* @brief firstPoint id first line point.
*/
quint32 firstPoint; quint32 firstPoint;
/**
* @brief secondPoint id second line point. /** @brief secondPoint id second line point. */
*/
quint32 secondPoint; quint32 secondPoint;
/**
* @brief RefreshGeometry refresh item on scene.
*/
void RefreshGeometry(); void RefreshGeometry();
}; };

View File

@ -33,6 +33,18 @@
const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect"); const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolLineIntersect constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param p1Line1 id first point first line.
* @param p2Line1 id second point first line.
* @param p1Line2 id first point second line.
* @param p2Line2 id second point second line.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id, VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id,
const quint32 &p1Line1, const quint32 &p2Line1, const quint32 &p1Line2, const quint32 &p1Line1, const quint32 &p2Line1, const quint32 &p1Line2,
const quint32 &p2Line2, const Source &typeCreation, const quint32 &p2Line2, const Source &typeCreation,
@ -52,6 +64,9 @@ VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const qu
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolLineIntersect::setDialog() void VToolLineIntersect::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -66,6 +81,13 @@ void VToolLineIntersect::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -81,6 +103,22 @@ void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param p1Line1Id id first point first line.
* @param p2Line1Id id second point first line.
* @param p1Line2Id id first point second line.
* @param p2Line2Id id second point second line.
* @param pointName point name.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
void VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id, void VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id,
const quint32 &p1Line2Id, const quint32 &p2Line2Id, const QString &pointName, const quint32 &p1Line2Id, const quint32 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
@ -137,6 +175,9 @@ void VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, con
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolLineIntersect::FullUpdateFromFile() void VToolLineIntersect::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -151,6 +192,10 @@ void VToolLineIntersect::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolLineIntersect::SetFactor(qreal factor) void VToolLineIntersect::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -158,18 +203,29 @@ void VToolLineIntersect::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolLineIntersect::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolLineIntersect::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogLineIntersect>(this, event); ContextMenu<DialogLineIntersect>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogLineIntersect>(this, event); ContextMenu<DialogLineIntersect>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolLineIntersect::AddToFile() void VToolLineIntersect::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -190,6 +246,9 @@ void VToolLineIntersect::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolLineIntersect::RefreshDataInFile() void VToolLineIntersect::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -207,6 +266,9 @@ void VToolLineIntersect::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolLineIntersect::RemoveReferens() void VToolLineIntersect::RemoveReferens()
{ {
doc->DecrementReferens(p1Line1); doc->DecrementReferens(p1Line1);
@ -216,6 +278,9 @@ void VToolLineIntersect::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolLineIntersect::SaveDialog(QDomElement &domElement) void VToolLineIntersect::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);

View File

@ -38,107 +38,37 @@ class VToolLineIntersect:public VToolPoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolLineIntersect constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param p1Line1 id first point first line.
* @param p2Line1 id second point first line.
* @param p1Line2 id first point second line.
* @param p2Line2 id second point second line.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &p1Line1, VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &p1Line1,
const quint32 &p2Line1, const quint32 &p1Line2, const quint32 &p2Line2, const quint32 &p2Line1, const quint32 &p1Line2, const quint32 &p2Line2,
const Source &typeCreation, QGraphicsItem * parent = nullptr); const Source &typeCreation, QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param p1Line1Id id first point first line.
* @param p2Line1Id id second point first line.
* @param p1Line2Id id first point second line.
* @param p2Line2Id id second point second line.
* @param pointName point name.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id, const quint32 &p1Line2Id, static void Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id, const quint32 &p1Line2Id,
const quint32 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, const quint32 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/** /** @brief p1Line1 id first point first line. */
* @brief p1Line1 id first point first line.
*/
quint32 p1Line1; quint32 p1Line1;
/**
* @brief p2Line1 id second point first line. /** @brief p2Line1 id second point first line. */
*/
quint32 p2Line1; quint32 p2Line1;
/**
* @brief p1Line2 id first point second line. /** @brief p1Line2 id first point second line. */
*/
quint32 p1Line2; quint32 p1Line2;
/**
* @brief p2Line2 id second point second line. /** @brief p2Line2 id second point second line.*/
*/
quint32 p2Line2; quint32 p2Line2;
}; };

View File

@ -30,6 +30,17 @@
#include "../../geometry/vpointf.h" #include "../../geometry/vpointf.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolLinePoint constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeLine line type.
* @param formula string with length formula.
* @param basePointId id base line point.
* @param angle line angle.
* @param parent parent object.
*/
VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id,
const QString &typeLine, const QString &formula, const quint32 &basePointId, const QString &typeLine, const QString &formula, const quint32 &basePointId,
const qreal &angle, QGraphicsItem *parent) const qreal &angle, QGraphicsItem *parent)
@ -46,6 +57,10 @@ VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &i
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
void VToolLinePoint::ChangedActivDraw(const QString &newName) void VToolLinePoint::ChangedActivDraw(const QString &newName)
{ {
if (nameActivDraw == newName) if (nameActivDraw == newName)
@ -61,6 +76,9 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolLinePoint::RefreshGeometry() void VToolLinePoint::RefreshGeometry()
{ {
mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle())); mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle()));
@ -71,6 +89,19 @@ void VToolLinePoint::RefreshGeometry()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolLinePoint::RemoveReferens()
{
doc->DecrementReferens(basePointId);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolLinePoint::SetFactor(qreal factor) void VToolLinePoint::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);

View File

@ -38,56 +38,26 @@ class VToolLinePoint : public VToolPoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/** VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
* @brief VToolLinePoint constructor. const quint32 &basePointId, const qreal &angle, QGraphicsItem * parent = nullptr);
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeLine line type.
* @param formula string with length formula.
* @param basePointId id base line point.
* @param angle line angle.
* @param parent parent object.
*/
VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &basePointId, const qreal &angle,
QGraphicsItem * parent = nullptr);
public slots: public slots:
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
protected: protected:
/** /** @brief formula string with length formula. */
* @brief formula string with length formula.
*/
QString formula; QString formula;
/**
* @brief angle line angle. /** @brief angle line angle. */
*/
qreal angle; qreal angle;
/**
* @brief basePointId id base line point. /** @brief basePointId id base line point. */
*/
quint32 basePointId; quint32 basePointId;
/**
* @brief mainLine line item. /** @brief mainLine line item. */
*/
QGraphicsLineItem *mainLine; QGraphicsLineItem *mainLine;
/**
* @brief RefreshGeometry refresh item on scene.
*/
virtual void RefreshGeometry(); virtual void RefreshGeometry();
/** virtual void RemoveReferens();
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens() {doc->DecrementReferens(basePointId);}
private: private:
Q_DISABLE_COPY(VToolLinePoint) Q_DISABLE_COPY(VToolLinePoint)
}; };

View File

@ -34,6 +34,19 @@
const QString VToolNormal::ToolType = QStringLiteral("normal"); const QString VToolNormal::ToolType = QStringLiteral("normal");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolNormal constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeLine line type.
* @param formula string with formula normal length.
* @param angle additional angle.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const quint32 &firstPointId, const QString &formula, const qreal &angle, const quint32 &firstPointId,
const quint32 &secondPointId, const Source &typeCreation, QGraphicsItem *parent) const quint32 &secondPointId, const Source &typeCreation, QGraphicsItem *parent)
@ -52,6 +65,9 @@ VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, con
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolNormal::setDialog() void VToolNormal::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -67,6 +83,13 @@ void VToolNormal::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -89,6 +112,23 @@ VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param formula string with formula normal length.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param typeLine line type.
* @param pointName point name.
* @param angle additional angle.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quint32 &firstPointId, VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const QString &typeLine, const QString &pointName, const quint32 &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,
@ -134,6 +174,14 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FindPoint return normal point.
* @param firstPoint first line point.
* @param secondPoint second line point.
* @param length normal length.
* @param angle additional angle.
* @return normal point.
*/
QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length,
const qreal &angle) const qreal &angle)
{ {
@ -145,6 +193,9 @@ QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondP
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolNormal::FullUpdateFromFile() void VToolNormal::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -160,6 +211,10 @@ void VToolNormal::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolNormal::SetFactor(qreal factor) void VToolNormal::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -167,18 +222,29 @@ void VToolNormal::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolNormal::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolNormal::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogNormal>(this, event); ContextMenu<DialogNormal>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogNormal>(this, event); ContextMenu<DialogNormal>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolNormal::AddToFile() void VToolNormal::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -200,6 +266,9 @@ void VToolNormal::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolNormal::RefreshDataInFile() void VToolNormal::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -218,6 +287,9 @@ void VToolNormal::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolNormal::RemoveReferens() void VToolNormal::RemoveReferens()
{ {
doc->DecrementReferens(secondPointId); doc->DecrementReferens(secondPointId);
@ -225,6 +297,9 @@ void VToolNormal::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolNormal::SaveDialog(QDomElement &domElement) void VToolNormal::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);

View File

@ -38,109 +38,30 @@ class VToolNormal : public VToolLinePoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/** VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
* @brief VToolNormal constructor. const qreal &angle, const quint32 &firstPointId, const quint32 &secondPointId,
* @param doc dom document container. const Source &typeCreation, QGraphicsItem * parent = nullptr);
* @param data container with variables.
* @param id object id in container.
* @param typeLine line type.
* @param formula string with formula normal length.
* @param angle additional angle.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const quint32 &firstPointId,
const quint32 &secondPointId, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static VToolNormal* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static VToolNormal* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param formula string with formula normal length.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param typeLine line type.
* @param pointName point name.
* @param angle additional angle.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static VToolNormal* Create(const quint32 _id, QString &formula, const quint32 &firstPointId, static VToolNormal* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const QString &typeLine, const QString &pointName, const quint32 &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,
VPattern *doc, VContainer *data, const Document &parse, VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
const Source &typeCreation);
/**
* @brief FindPoint return normal point.
* @param firstPoint first line point.
* @param secondPoint second line point.
* @param length normal length.
* @param angle additional angle.
* @return normal point.
*/
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length,
const qreal &angle = 0); const qreal &angle = 0);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/** /** @brief secondPointId id second line point. */
* @brief secondPointId id second line point.
*/
quint32 secondPointId; quint32 secondPointId;
}; };

View File

@ -36,6 +36,13 @@ const QString VToolPoint::TagName = QStringLiteral("point");
#define DefRadius 2.0//mm #define DefRadius 2.0//mm
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolPoint constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param parent parent object.
*/
VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent):VDrawTool(doc, data, id), VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent):VDrawTool(doc, data, id),
QGraphicsEllipseItem(parent), radius(DefRadius), namePoint(0), lineName(0) QGraphicsEllipseItem(parent), radius(DefRadius), namePoint(0), lineName(0)
{ {
@ -54,6 +61,10 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief NameChangePosition handle change posion point label.
* @param pos new position.
*/
void VToolPoint::NameChangePosition(const QPointF &pos) void VToolPoint::NameChangePosition(const QPointF &pos)
{ {
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
@ -66,6 +77,11 @@ void VToolPoint::NameChangePosition(const QPointF &pos)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief UpdateNamePosition save new position label to the pattern file.
* @param mx label bias x axis.
* @param my label bias y axis.
*/
void VToolPoint::UpdateNamePosition(qreal mx, qreal my) void VToolPoint::UpdateNamePosition(qreal mx, qreal my)
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -78,6 +94,10 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
void VToolPoint::ChangedActivDraw(const QString &newName) void VToolPoint::ChangedActivDraw(const QString &newName)
{ {
bool selectable = false; bool selectable = false;
@ -104,12 +124,22 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowTool highlight tool.
* @param id object id in container.
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void VToolPoint::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) void VToolPoint::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
ShowItem(this, id, color, enable); ShowItem(this, id, color, enable);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolPoint::SetFactor(qreal factor) void VToolPoint::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -117,12 +147,20 @@ void VToolPoint::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -133,6 +171,10 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -140,6 +182,10 @@ void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -147,6 +193,10 @@ void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshPointGeometry refresh point on scene.
* @param point point.
*/
void VToolPoint::RefreshPointGeometry(const VPointF &point) void VToolPoint::RefreshPointGeometry(const VPointF &point)
{ {
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
@ -166,6 +216,9 @@ void VToolPoint::RefreshPointGeometry(const VPointF &point)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshLine refresh line to label on scene.
*/
void VToolPoint::RefreshLine() void VToolPoint::RefreshLine()
{ {
QRectF nameRec = namePoint->sceneBoundingRect(); QRectF nameRec = namePoint->sceneBoundingRect();
@ -192,6 +245,12 @@ void VToolPoint::RefreshLine()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemChange hadle item change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant VToolPoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VToolPoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == QGraphicsItem::ItemSelectedChange) if (change == QGraphicsItem::ItemSelectedChange)
@ -211,6 +270,10 @@ QVariant VToolPoint::itemChange(QGraphicsItem::GraphicsItemChange change, const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief keyReleaseEvent handle key release events.
* @param event key release event.
*/
void VToolPoint::keyReleaseEvent(QKeyEvent *event) void VToolPoint::keyReleaseEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())

View File

@ -41,98 +41,32 @@ class VToolPoint: public VDrawTool, public QGraphicsEllipseItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolPoint constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param parent parent object.
*/
VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr); VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr);
virtual ~VToolPoint(){} virtual ~VToolPoint(){}
static const QString TagName; static const QString TagName;
public slots: public slots:
/**
* @brief NameChangePosition handle change posion point label.
* @param pos new position.
*/
void NameChangePosition(const QPointF &pos); void NameChangePosition(const QPointF &pos);
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
/**
* @brief ShowTool highlight tool.
* @param id object id in container.
* @param color highlight color.
* @param enable enable or disable highlight.
*/
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/** /** @brief radius radius circle. */
* @brief radius radius circle.
*/
qreal radius; qreal radius;
/**
* @brief namePoint point label. /** @brief namePoint point label. */
*/
VGraphicsSimpleTextItem *namePoint; VGraphicsSimpleTextItem *namePoint;
/**
* @brief lineName line what we see if label moved too away from point. /** @brief lineName line what we see if label moved too away from point. */
*/
QGraphicsLineItem *lineName; QGraphicsLineItem *lineName;
/**
* @brief UpdateNamePosition save new position label to the pattern file.
* @param mx label bias x axis.
* @param my label bias y axis.
*/
virtual void UpdateNamePosition(qreal mx, qreal my); virtual void UpdateNamePosition(qreal mx, qreal my);
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief RefreshPointGeometry refresh point on scene.
* @param point point.
*/
virtual void RefreshPointGeometry(const VPointF &point); virtual void RefreshPointGeometry(const VPointF &point);
/**
* @brief RefreshLine refresh line to label on scene.
*/
void RefreshLine(); void RefreshLine();
/**
* @brief itemChange hadle item change.
* @param change change.
* @param value value.
* @return value.
*/
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
/**
* @brief keyReleaseEvent handle key release events.
* @param event key release event.
*/
virtual void keyReleaseEvent(QKeyEvent * event); virtual void keyReleaseEvent(QKeyEvent * event);
private: private:
Q_DISABLE_COPY(VToolPoint) Q_DISABLE_COPY(VToolPoint)

View File

@ -34,6 +34,18 @@
const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact"); const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolPointOfContact constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param arcRadius string with formula radius arc.
* @param center id center arc point.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id, VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id,
const QString &radius, const quint32 &center, const QString &radius, const quint32 &center,
const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &firstPointId, const quint32 &secondPointId,
@ -52,6 +64,9 @@ VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolPointOfContact::setDialog() void VToolPointOfContact::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -66,6 +81,14 @@ void VToolPointOfContact::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FindPoint return point intersection line and arc.
* @param arcRadius string with formula radius arc.
* @param center center arc point.
* @param firstPoint first line point.
* @param secondPoint second line point.
* @return point intersection.
*/
QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF &center, const QPointF &firstPoint, QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF &center, const QPointF &firstPoint,
const QPointF &secondPoint) const QPointF &secondPoint)
{ {
@ -93,7 +116,15 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF &cente
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolPointOfContact* VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) /**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
VToolPointOfContact* VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog); DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
@ -114,9 +145,26 @@ VToolPointOfContact* VToolPointOfContact::Create(DialogTool *dialog, VMainGraphi
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint32 &center, const quint32 &firstPointId, /**
const quint32 &secondPointId, const QString &pointName, const qreal &mx, * @brief Create help create tool.
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, * @param _id tool id, 0 if tool doesn't exist yet.
* @param arcRadius string with formula radius arc.
* @param center id center arc point.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param pointName point name.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint32 &center,
const quint32 &firstPointId, const quint32 &secondPointId,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation) const Document &parse, const Source &typeCreation)
{ {
const VPointF *centerP = data->GeometricObject<const VPointF *>(center); const VPointF *centerP = data->GeometricObject<const VPointF *>(center);
@ -164,6 +212,9 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolPointOfContact::FullUpdateFromFile() void VToolPointOfContact::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -178,6 +229,10 @@ void VToolPointOfContact::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolPointOfContact::SetFactor(qreal factor) void VToolPointOfContact::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -185,18 +240,29 @@ void VToolPointOfContact::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolPointOfContact::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolPointOfContact::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogPointOfContact>(this, event); ContextMenu<DialogPointOfContact>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogPointOfContact>(this, event); ContextMenu<DialogPointOfContact>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolPointOfContact::AddToFile() void VToolPointOfContact::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -217,6 +283,9 @@ void VToolPointOfContact::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolPointOfContact::RefreshDataInFile() void VToolPointOfContact::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -234,6 +303,9 @@ void VToolPointOfContact::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolPointOfContact::RemoveReferens() void VToolPointOfContact::RemoveReferens()
{ {
doc->DecrementReferens(center); doc->DecrementReferens(center);
@ -242,6 +314,9 @@ void VToolPointOfContact::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolPointOfContact::SaveDialog(QDomElement &domElement) void VToolPointOfContact::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);

View File

@ -37,118 +37,40 @@
class VToolPointOfContact : public VToolPoint class VToolPointOfContact : public VToolPoint
{ {
public: public:
/** VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id, const QString &arcRadius,
* @brief VToolPointOfContact constructor. const quint32 &center, const quint32 &firstPointId, const quint32 &secondPointId,
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param arcRadius string with formula radius arc.
* @param center id center arc point.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id,
const QString &arcRadius, const quint32 &center,
const quint32 &firstPointId, const quint32 &secondPointId,
const Source &typeCreation, QGraphicsItem * parent = nullptr); const Source &typeCreation, QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief FindPoint return point intersection line and arc.
* @param arcRadius string with formula radius arc.
* @param center center arc point.
* @param firstPoint first line point.
* @param secondPoint second line point.
* @return point intersection.
*/
static QPointF FindPoint(const qreal &arcRadius, const QPointF &center, const QPointF &firstPoint, static QPointF FindPoint(const qreal &arcRadius, const QPointF &center, const QPointF &firstPoint,
const QPointF &secondPoint); const QPointF &secondPoint);
/** static VToolPointOfContact* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
* @brief Create help create tool from GUI. VContainer *data);
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static VToolPointOfContact* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param arcRadius string with formula radius arc.
* @param center id center arc point.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param pointName point name.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static VToolPointOfContact* Create(const quint32 _id, QString &arcRadius, const quint32 &center, static VToolPointOfContact* Create(const quint32 _id, QString &arcRadius, const quint32 &center,
const quint32 &firstPointId, const quint32 &secondPointId, const QString &pointName, const quint32 &firstPointId, const quint32 &secondPointId, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/** /** @brief radius string with formula radius arc. */
* @brief radius string with formula radius arc.
*/
QString arcRadius; QString arcRadius;
/**
* @brief center id center arc point. /** @brief center id center arc point. */
*/
quint32 center; quint32 center;
/**
* @brief firstPointId id first line point. /** @brief firstPointId id first line point. */
*/
quint32 firstPointId; quint32 firstPointId;
/**
* @brief secondPointId id second line point. /** @brief secondPointId id second line point. */
*/
quint32 secondPointId; quint32 secondPointId;
}; };

View File

@ -33,6 +33,16 @@
const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection"); const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolPointOfIntersection constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id, VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id,
const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &firstPointId, const quint32 &secondPointId,
const Source &typeCreation, QGraphicsItem *parent) const Source &typeCreation, QGraphicsItem *parent)
@ -50,6 +60,9 @@ VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *da
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolPointOfIntersection::setDialog() void VToolPointOfIntersection::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -62,6 +75,13 @@ void VToolPointOfIntersection::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data) VContainer *data)
{ {
@ -75,6 +95,20 @@ void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *sc
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId, void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my, const quint32 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@ -112,6 +146,9 @@ void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointNam
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolPointOfIntersection::FullUpdateFromFile() void VToolPointOfIntersection::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -124,12 +161,19 @@ void VToolPointOfIntersection::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolPointOfIntersection::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolPointOfIntersection::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogPointOfIntersection>(this, event); ContextMenu<DialogPointOfIntersection>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolPointOfIntersection::RemoveReferens() void VToolPointOfIntersection::RemoveReferens()
{ {
doc->DecrementReferens(firstPointId); doc->DecrementReferens(firstPointId);
@ -137,12 +181,19 @@ void VToolPointOfIntersection::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogPointOfIntersection>(this, event); ContextMenu<DialogPointOfIntersection>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolPointOfIntersection::AddToFile() void VToolPointOfIntersection::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -161,6 +212,9 @@ void VToolPointOfIntersection::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolPointOfIntersection::RefreshDataInFile() void VToolPointOfIntersection::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -176,6 +230,9 @@ void VToolPointOfIntersection::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolPointOfIntersection::SaveDialog(QDomElement &domElement) void VToolPointOfIntersection::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);

View File

@ -38,91 +38,31 @@ class VToolPointOfIntersection : public VToolPoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/** VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &firstPointId,
* @brief VToolPointOfIntersection constructor. const quint32 &secondPointId, const Source &typeCreation,
* @param doc dom document container. QGraphicsItem * parent = nullptr);
* @param data container with variables.
* @param id object id in container.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id,
const quint32 &firstPointId, const quint32 &secondPointId,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param firstPointId id first line point.
* @param secondPointId id second line point.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId, static void Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation); const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
Q_DISABLE_COPY(VToolPointOfIntersection) Q_DISABLE_COPY(VToolPointOfIntersection)
/** /** @brief firstPointId id first line point. */
* @brief firstPointId id first line point.
*/
quint32 firstPointId; quint32 firstPointId;
/**
* @brief secondPointId id second line point. /** @brief secondPointId id second line point. */
*/
quint32 secondPointId; quint32 secondPointId;
}; };

View File

@ -34,6 +34,19 @@
const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder"); const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolShoulderPoint constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeLine line type.
* @param formula string with formula length.
* @param p1Line id first line point.
* @param p2Line id second line point.
* @param pShoulder id shoulder point.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &p1Line, const quint32 &p2Line, const QString &formula, const quint32 &p1Line, const quint32 &p2Line,
const quint32 &pShoulder, const Source &typeCreation, const quint32 &pShoulder, const Source &typeCreation,
@ -51,6 +64,9 @@ VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const qu
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolShoulderPoint::setDialog() void VToolShoulderPoint::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -66,6 +82,14 @@ void VToolShoulderPoint::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FindPoint find point.
* @param p1Line first line point.
* @param p2Line second line point.
* @param pShoulder shoulder point.
* @param length length form shoulder point to our.
* @return point.
*/
//TODO find better way calculate point. //TODO find better way calculate point.
QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder,
const qreal &length) const qreal &length)
@ -95,7 +119,15 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) /**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog); DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
@ -117,6 +149,23 @@ VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphics
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param formula string with formula length.
* @param p1Line id first line point.
* @param p2Line id second line point.
* @param pShoulder id shoulder point.
* @param typeLine line type.
* @param pointName point name.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formula, const quint32 &p1Line, VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formula, const quint32 &p1Line,
const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine, const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, const QString &pointName, const qreal &mx, const qreal &my,
@ -167,6 +216,9 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolShoulderPoint::FullUpdateFromFile() void VToolShoulderPoint::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -182,6 +234,10 @@ void VToolShoulderPoint::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolShoulderPoint::SetFactor(qreal factor) void VToolShoulderPoint::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -189,18 +245,29 @@ void VToolShoulderPoint::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolShoulderPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolShoulderPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogShoulderPoint>(this, event); ContextMenu<DialogShoulderPoint>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogShoulderPoint>(this, event); ContextMenu<DialogShoulderPoint>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolShoulderPoint::AddToFile() void VToolShoulderPoint::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -222,6 +289,9 @@ void VToolShoulderPoint::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolShoulderPoint::RefreshDataInFile() void VToolShoulderPoint::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -240,6 +310,9 @@ void VToolShoulderPoint::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolShoulderPoint::RemoveReferens() void VToolShoulderPoint::RemoveReferens()
{ {
doc->DecrementReferens(p2Line); doc->DecrementReferens(p2Line);
@ -248,6 +321,9 @@ void VToolShoulderPoint::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolShoulderPoint::SaveDialog(QDomElement &domElement) void VToolShoulderPoint::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);

View File

@ -38,112 +38,33 @@
class VToolShoulderPoint : public VToolLinePoint class VToolShoulderPoint : public VToolLinePoint
{ {
public: public:
/**
* @brief VToolShoulderPoint constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeLine line type.
* @param formula string with formula length.
* @param p1Line id first line point.
* @param p2Line id second line point.
* @param pShoulder id shoulder point.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &p1Line, const quint32 &p2Line, const QString &formula, const quint32 &p1Line, const quint32 &p2Line, const quint32 &pShoulder,
const quint32 &pShoulder, const Source &typeCreation, const Source &typeCreation, QGraphicsItem * parent = nullptr);
QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief FindPoint find point.
* @param p1Line first line point.
* @param p2Line second line point.
* @param pShoulder shoulder point.
* @param length length form shoulder point to our.
* @return point.
*/
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);
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static VToolShoulderPoint* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static VToolShoulderPoint* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param formula string with formula length.
* @param p1Line id first line point.
* @param p2Line id second line point.
* @param pShoulder id shoulder point.
* @param typeLine line type.
* @param pointName point name.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static VToolShoulderPoint* Create(const quint32 _id, QString &formula, const quint32 &p1Line, const quint32 &p2Line, static VToolShoulderPoint* Create(const quint32 _id, QString &formula, const quint32 &p1Line, const quint32 &p2Line,
const quint32 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const quint32 &pShoulder, const QString &typeLine, const QString &pointName,
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/** /** @brief p2Line id second line point. */
* @brief p2Line id second line point.
*/
quint32 p2Line; quint32 p2Line;
/**
* @brief pShoulder id shoulder line point. /** @brief pShoulder id shoulder line point. */
*/
quint32 pShoulder; quint32 pShoulder;
}; };

View File

@ -36,6 +36,14 @@
const QString VToolSinglePoint::ToolType = QStringLiteral("single"); const QString VToolSinglePoint::ToolType = QStringLiteral("single");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolSinglePoint constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
const QString &namePP, const QString &mPath, QGraphicsItem * parent ) const QString &namePP, const QString &mPath, QGraphicsItem * parent )
:VToolPoint(doc, data, id, parent), namePP(namePP), mPath(mPath) :VToolPoint(doc, data, id, parent), namePP(namePP), mPath(mPath)
@ -59,6 +67,9 @@ VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolSinglePoint::setDialog() void VToolSinglePoint::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -69,6 +80,9 @@ void VToolSinglePoint::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolSinglePoint::AddToFile() void VToolSinglePoint::AddToFile()
{ {
Q_ASSERT_X(namePP.isEmpty() == false, "AddToFile", "name pattern piece is empty"); Q_ASSERT_X(namePP.isEmpty() == false, "AddToFile", "name pattern piece is empty");
@ -103,6 +117,9 @@ void VToolSinglePoint::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolSinglePoint::RefreshDataInFile() void VToolSinglePoint::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -118,6 +135,12 @@ void VToolSinglePoint::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemChange handle tool change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == ItemPositionChange && scene()) if (change == ItemPositionChange && scene())
@ -147,6 +170,9 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief decrementReferens decrement referens parents objects.
*/
void VToolSinglePoint::decrementReferens() void VToolSinglePoint::decrementReferens()
{ {
if (_referens > 1) if (_referens > 1)
@ -156,6 +182,9 @@ void VToolSinglePoint::decrementReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolSinglePoint::SaveDialog(QDomElement &domElement) void VToolSinglePoint::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -169,6 +198,10 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setColorLabel change color for label and label line.
* @param color new color.
*/
void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color) void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color)
{ {
namePoint->setBrush(color); namePoint->setBrush(color);
@ -176,12 +209,19 @@ void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
{ {
ContextMenu<DialogSinglePoint>(this, event, false); ContextMenu<DialogSinglePoint>(this, event, false);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolSinglePoint::FullUpdateFromFile() void VToolSinglePoint::FullUpdateFromFile()
{ {
VPointF point = *VAbstractTool::data.GeometricObject<const VPointF *>(id); VPointF point = *VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -189,6 +229,10 @@ void VToolSinglePoint::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
void VToolSinglePoint::ChangedActivDraw(const QString &newName) void VToolSinglePoint::ChangedActivDraw(const QString &newName)
{ {
if (nameActivDraw == newName) if (nameActivDraw == newName)
@ -206,6 +250,10 @@ void VToolSinglePoint::ChangedActivDraw(const QString &newName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolSinglePoint::SetFactor(qreal factor) void VToolSinglePoint::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
@ -213,6 +261,10 @@ void VToolSinglePoint::SetFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolSinglePoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolSinglePoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogSinglePoint>(this, event, false); ContextMenu<DialogSinglePoint>(this, event, false);

View File

@ -39,41 +39,15 @@ class VToolSinglePoint : public VToolPoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolSinglePoint constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
const QString &namePP = QString(), const QString &mPath = QString(), const QString &namePP = QString(), const QString &mPath = QString(),
QGraphicsItem * parent = nullptr ); QGraphicsItem * parent = nullptr );
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
signals: signals:
/** /**
@ -81,46 +55,20 @@ signals:
*/ */
void LiteUpdateTree(); void LiteUpdateTree();
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief itemChange handle tool change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
/**
* @brief decrementReferens decrement referens parents objects.
*/
virtual void decrementReferens(); virtual void decrementReferens();
/** /**
* @brief DeleteTool delete tool from file and scene. This tool can't be deleted by now. * @brief DeleteTool delete tool from file and scene. This tool can't be deleted by now.
* @param tool tool what me delete. * @param tool tool what me delete.
*/ */
virtual void DeleteTool(QGraphicsItem *tool){Q_UNUSED(tool)} virtual void DeleteTool(QGraphicsItem *tool){Q_UNUSED(tool)}
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
QString namePP; QString namePP;
QString mPath; QString mPath;
/**
* @brief setColorLabel change color for label and label line.
* @param color new color.
*/
void setColorLabel(const Qt::GlobalColor & color); void setColorLabel(const Qt::GlobalColor & color);
}; };

View File

@ -34,6 +34,14 @@
const QString VToolSpline::ToolType = QStringLiteral("simple"); const QString VToolSpline::ToolType = QStringLiteral("simple");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolSpline constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent)
{ {
@ -74,6 +82,9 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Sour
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolSpline::setDialog() void VToolSpline::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -90,8 +101,14 @@ void VToolSpline::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, /**
VContainer *data) * @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
DialogSpline *dialogTool = qobject_cast<DialogSpline*>(dialog); DialogSpline *dialogTool = qobject_cast<DialogSpline*>(dialog);
@ -108,6 +125,22 @@ void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param p1 id first spline point.
* @param p4 id last spline point.
* @param kAsm1 coefficient of length first control line.
* @param kAsm2 coefficient of length second control line.
* @param angle1 angle from first point to first control point.
* @param angle2 angle from second point to second control point.
* @param kCurve coefficient of curvature spline.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1, void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1,
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@ -145,6 +178,12 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ControlPointChangePosition handle change position control point.
* @param indexSpline position spline in spline list.
* @param position position point in spline.
* @param pos new position.
*/
void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const SplinePointPosition &position, void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const SplinePointPosition &position,
const QPointF &pos) const QPointF &pos)
{ {
@ -166,11 +205,19 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogSpline>(this, event); ContextMenu<DialogSpline>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolSpline::AddToFile() void VToolSpline::AddToFile()
{ {
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id); const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
@ -190,6 +237,9 @@ void VToolSpline::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolSpline::RefreshDataInFile() void VToolSpline::RefreshDataInFile()
{ {
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id); const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
@ -207,6 +257,10 @@ void VToolSpline::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event context menu event.
*/
void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -217,6 +271,9 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolSpline::RemoveReferens() void VToolSpline::RemoveReferens()
{ {
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id); const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
@ -225,6 +282,9 @@ void VToolSpline::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolSpline::SaveDialog(QDomElement &domElement) void VToolSpline::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -259,6 +319,9 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolSpline::RefreshGeometry() void VToolSpline::RefreshGeometry()
{ {
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));

View File

@ -38,89 +38,27 @@ class VToolSpline:public VAbstractSpline
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolSpline constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSpline (VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, VToolSpline (VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr ); QGraphicsItem * parent = nullptr );
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param p1 id first spline point.
* @param p4 id last spline point.
* @param kAsm1 coefficient of length first control line.
* @param kAsm2 coefficient of length second control line.
* @param angle1 angle from first point to first control point.
* @param angle2 angle from second point to second control point.
* @param kCurve coefficient of curvature spline.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1, static void Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1,
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
/**
* @brief ControlPointChangePosition handle change position control point.
* @param indexSpline position spline in spline list.
* @param position position point in spline.
* @param pos new position.
*/
void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position, void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position,
const QPointF &pos); const QPointF &pos);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile (); virtual void AddToFile ();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event context menu event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/**
* @brief RefreshGeometry refresh item on scene.
*/
void RefreshGeometry (); void RefreshGeometry ();
}; };

View File

@ -33,6 +33,14 @@
const QString VToolSplinePath::ToolType = QStringLiteral("path"); const QString VToolSplinePath::ToolType = QStringLiteral("path");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolSplinePath constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent)
{ {
@ -57,7 +65,8 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co
connect(this, &VToolSplinePath::setEnabledPoint, controlPoint, &VControlPointSpline::setEnabledPoint); connect(this, &VToolSplinePath::setEnabledPoint, controlPoint, &VControlPointSpline::setEnabledPoint);
controlPoints.append(controlPoint); controlPoints.append(controlPoint);
controlPoint = new VControlPointSpline(i, SplinePointPosition::LastPoint, spl.GetP3(), spl.GetP4().toQPointF(), this); controlPoint = new VControlPointSpline(i, SplinePointPosition::LastPoint, spl.GetP3(), spl.GetP4().toQPointF(),
this);
connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this, connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this,
&VToolSplinePath::ControlPointChangePosition); &VToolSplinePath::ControlPointChangePosition);
connect(this, &VToolSplinePath::RefreshLine, controlPoint, &VControlPointSpline::RefreshLine); connect(this, &VToolSplinePath::RefreshLine, controlPoint, &VControlPointSpline::RefreshLine);
@ -75,6 +84,9 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolSplinePath::setDialog() void VToolSplinePath::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -85,6 +97,13 @@ void VToolSplinePath::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -99,9 +118,18 @@ void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, /**
VPattern *doc, VContainer *data, const Document &parse, * @brief Create help create tool.
const Source &typeCreation) * @param _id tool id, 0 if tool doesn't exist yet.
* @param path spline path.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{ {
quint32 id = _id; quint32 id = _id;
if (typeCreation == Source::FromGui) if (typeCreation == Source::FromGui)
@ -130,6 +158,12 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ControlPointChangePosition handle change position control point.
* @param indexSpline position spline in spline list.
* @param position position point in spline.
* @param pos new position.
*/
void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, const SplinePointPosition &position, void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, const SplinePointPosition &position,
const QPointF &pos) const QPointF &pos)
{ {
@ -153,6 +187,12 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief UpdateControlPoints update position points control points in file.
* @param spl spline what was changed.
* @param splPath spline path.
* @param indexSpline index spline in spline path.
*/
void VToolSplinePath::UpdateControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline) const void VToolSplinePath::UpdateControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline) const
{ {
VSplinePoint p = splPath.GetSplinePoint(indexSpline, SplinePointPosition::FirstPoint); VSplinePoint p = splPath.GetSplinePoint(indexSpline, SplinePointPosition::FirstPoint);
@ -191,6 +231,12 @@ void VToolSplinePath::RefreshSplinePath(VSplinePath &splPath)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief UpdatePathPoint update spline path in pattern file.
* @brief doc dom document container.
* @param node tag in file.
* @param path spline path.
*/
void VToolSplinePath::UpdatePathPoint(VPattern *doc, QDomNode& node, const VSplinePath &path) void VToolSplinePath::UpdatePathPoint(VPattern *doc, QDomNode& node, const VSplinePath &path)
{ {
SCASSERT(doc != nullptr) SCASSERT(doc != nullptr)
@ -211,12 +257,19 @@ void VToolSplinePath::UpdatePathPoint(VPattern *doc, QDomNode& node, const VSpli
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogSplinePath>(this, event); ContextMenu<DialogSplinePath>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolSplinePath::AddToFile() void VToolSplinePath::AddToFile()
{ {
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id); VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
@ -235,6 +288,9 @@ void VToolSplinePath::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolSplinePath::RefreshDataInFile() void VToolSplinePath::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -250,6 +306,11 @@ void VToolSplinePath::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddPathPoint write path point to pattern file.
* @param domElement dom element.
* @param splPoint spline path point.
*/
void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint) void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint)
{ {
QDomElement pathPoint = doc->createElement(AttrPathPoint); QDomElement pathPoint = doc->createElement(AttrPathPoint);
@ -263,6 +324,10 @@ void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -273,6 +338,9 @@ void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolSplinePath::RemoveReferens() void VToolSplinePath::RemoveReferens()
{ {
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id); VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
@ -283,6 +351,9 @@ void VToolSplinePath::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolSplinePath::SaveDialog(QDomElement &domElement) void VToolSplinePath::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -296,6 +367,9 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolSplinePath::RefreshGeometry() void VToolSplinePath::RefreshGeometry()
{ {
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));

View File

@ -38,48 +38,13 @@ class VToolSplinePath:public VAbstractSpline
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolSplinePath constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr); QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/** static void Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, VPattern *doc,
* @brief Create help create tool. VContainer *data, const Document &parse, const Source &typeCreation);
* @param _id tool id, 0 if tool doesn't exist yet.
* @param path spline path.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
/**
* @brief UpdatePathPoint update spline path in pattern file.
* @brief doc dom document container.
* @param node tag in file.
* @param path spline path.
*/
static void UpdatePathPoint(VPattern *doc, QDomNode& node, const VSplinePath &path); static void UpdatePathPoint(VPattern *doc, QDomNode& node, const VSplinePath &path);
signals: signals:
/** /**
@ -89,66 +54,27 @@ signals:
* @param controlPoint new position control point. * @param controlPoint new position control point.
* @param splinePoint new position spline point. * @param splinePoint new position spline point.
*/ */
void RefreshLine(const qint32 &indexSpline, SplinePointPosition pos, void RefreshLine(const qint32 &indexSpline, SplinePointPosition pos, const QPointF &controlPoint,
const QPointF &controlPoint, const QPointF &splinePoint); const QPointF &splinePoint);
/** /**
* @brief setEnabledPoint disable control points. * @brief setEnabledPoint disable control points.
* @param enable enable or diasable points. * @param enable enable or diasable points.
*/ */
void setEnabledPoint(bool enable); void setEnabledPoint(bool enable);
public slots: public slots:
/**
* @brief ControlPointChangePosition handle change position control point.
* @param indexSpline position spline in spline list.
* @param position position point in spline.
* @param pos new position.
*/
void ControlPointChangePosition(const qint32 &indexSpline, const SplinePointPosition &position, void ControlPointChangePosition(const qint32 &indexSpline, const SplinePointPosition &position,
const QPointF &pos); const QPointF &pos);
protected: protected:
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
/**
* @brief RefreshGeometry refresh item on scene.
*/
void RefreshGeometry(); void RefreshGeometry();
/**
* @brief AddPathPoint write path point to pattern file.
* @param domElement dom element.
* @param splPoint spline path point.
*/
void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint); void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint);
/**
* @brief UpdateControlPoints update position points control points in file.
* @param spl spline what was changed.
* @param splPath spline path.
* @param indexSpline index spline in spline path.
*/
void UpdateControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline) const; void UpdateControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline) const;
void RefreshSplinePath(VSplinePath &splPath); void RefreshSplinePath(VSplinePath &splPath);
}; };

View File

@ -33,6 +33,18 @@
const QString VToolTriangle::ToolType = QStringLiteral("triangle"); const QString VToolTriangle::ToolType = QStringLiteral("triangle");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolTriangle constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param axisP1Id id first axis point.
* @param axisP2Id id second axis point.
* @param firstPointId id first triangle point, what lies on the hypotenuse.
* @param secondPointId id second triangle point, what lies on the hypotenuse.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &axisP1Id, VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &axisP1Id,
const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId,
const Source &typeCreation, QGraphicsItem *parent) const Source &typeCreation, QGraphicsItem *parent)
@ -51,6 +63,9 @@ VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolTriangle::setDialog() void VToolTriangle::setDialog()
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -65,8 +80,14 @@ void VToolTriangle::setDialog()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene, /**
VPattern *doc, VContainer *data) * @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog); DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
@ -81,6 +102,22 @@ void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param axisP1Id id first axis point.
* @param axisP2Id id second axis point.
* @param firstPointId id first triangle point, what lies on the hypotenuse.
* @param secondPointId id second triangle point, what lies on the hypotenuse.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
void VToolTriangle::Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id, void VToolTriangle::Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id,
const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
@ -123,6 +160,14 @@ void VToolTriangle::Create(const quint32 _id, const QString &pointName, const qu
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FindPoint find point intersection two foots right triangle.
* @param axisP1 first axis point.
* @param axisP2 second axis point.
* @param firstPoint first triangle point, what lies on the hypotenuse.
* @param secondPoint second triangle point, what lies on the hypotenuse.
* @return point intersection two foots right triangle.
*/
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)
{ {
@ -165,6 +210,9 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolTriangle::FullUpdateFromFile() void VToolTriangle::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -179,12 +227,19 @@ void VToolTriangle::FullUpdateFromFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
void VToolTriangle::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolTriangle::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogTriangle>(this, event); ContextMenu<DialogTriangle>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolTriangle::RemoveReferens() void VToolTriangle::RemoveReferens()
{ {
doc->DecrementReferens(axisP1Id); doc->DecrementReferens(axisP1Id);
@ -194,12 +249,19 @@ void VToolTriangle::RemoveReferens()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogTriangle>(this, event); ContextMenu<DialogTriangle>(this, event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolTriangle::AddToFile() void VToolTriangle::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -220,6 +282,9 @@ void VToolTriangle::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolTriangle::RefreshDataInFile() void VToolTriangle::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -237,6 +302,9 @@ void VToolTriangle::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolTriangle::SaveDialog(QDomElement &domElement) void VToolTriangle::SaveDialog(QDomElement &domElement)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);

View File

@ -38,113 +38,39 @@ class VToolTriangle : public VToolPoint
{ {
Q_OBJECT Q_OBJECT
public: public:
/** VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &axisP1Id, const quint32 &axisP2Id,
* @brief VToolTriangle constructor. const quint32 &firstPointId, const quint32 &secondPointId, const Source &typeCreation,
* @param doc dom document container. QGraphicsItem * parent = nullptr);
* @param data container with variables.
* @param id object id in container.
* @param axisP1Id id first axis point.
* @param axisP2Id id second axis point.
* @param firstPointId id first triangle point, what lies on the hypotenuse.
* @param secondPointId id second triangle point, what lies on the hypotenuse.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &axisP1Id,
const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
/**
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog(); virtual void setDialog();
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param axisP1Id id first axis point.
* @param axisP2Id id second axis point.
* @param firstPointId id first triangle point, what lies on the hypotenuse.
* @param secondPointId id second triangle point, what lies on the hypotenuse.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id, const quint32 &axisP2Id, static void Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id, const quint32 &axisP2Id,
const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
/**
* @brief FindPoint find point intersection two foots right triangle.
* @param axisP1 first axis point.
* @param axisP2 second axis point.
* @param firstPoint first triangle point, what lies on the hypotenuse.
* @param secondPoint second triangle point, what lies on the hypotenuse.
* @return point intersection two foots right triangle.
*/
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:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief ShowContextMenu show context menu.
* @param event context menu event.
*/
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief RemoveReferens decrement value of reference.
*/
virtual void RemoveReferens(); virtual void RemoveReferens();
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief SaveDialog save options into file after change in dialog.
*/
virtual void SaveDialog(QDomElement &domElement); virtual void SaveDialog(QDomElement &domElement);
private: private:
Q_DISABLE_COPY(VToolTriangle) Q_DISABLE_COPY(VToolTriangle)
/** /** @brief axisP1Id id first axis point. */
* @brief axisP1Id id first axis point.
*/
quint32 axisP1Id; quint32 axisP1Id;
/**
* @brief axisP2Id id second axis point. /** @brief axisP2Id id second axis point. */
*/
quint32 axisP2Id; quint32 axisP2Id;
/**
* @brief firstPointId id first triangle point, what lies on the hypotenuse. /** @brief firstPointId id first triangle point, what lies on the hypotenuse. */
*/
quint32 firstPointId; quint32 firstPointId;
/**
* @brief secondPointId id second triangle point, what lies on the hypotenuse. /** @brief secondPointId id second triangle point, what lies on the hypotenuse. */
*/
quint32 secondPointId; quint32 secondPointId;
}; };

View File

@ -34,6 +34,15 @@ const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject");
const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool"); const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VAbstractNode constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idNode object id in containerNode.
* @param idTool id tool.
* @param parent parent object.
*/
VAbstractNode::VAbstractNode(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode, VAbstractNode::VAbstractNode(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
const quint32 &idTool, QObject *parent) const quint32 &idTool, QObject *parent)
: VAbstractTool(doc, data, id, parent), idNode(idNode), idTool(idTool) : VAbstractTool(doc, data, id, parent), idNode(idNode), idTool(idTool)
@ -59,6 +68,10 @@ void VAbstractNode::RestoreNode()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToModeling add tag to modeling tag current pattern peace.
* @param domElement tag.
*/
void VAbstractNode::AddToModeling(const QDomElement &domElement) void VAbstractNode::AddToModeling(const QDomElement &domElement)
{ {
QDomElement modelingElement; QDomElement modelingElement;
@ -75,6 +88,9 @@ void VAbstractNode::AddToModeling(const QDomElement &domElement)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief decrementReferens decrement reference for all parent objects.
*/
void VAbstractNode::decrementReferens() void VAbstractNode::decrementReferens()
{ {
if (_referens > 0) if (_referens > 0)

View File

@ -38,15 +38,6 @@ class VAbstractNode : public VAbstractTool
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VAbstractNode constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idNode object id in containerNode.
* @param idTool id tool.
* @param parent parent object.
*/
VAbstractNode(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode, VAbstractNode(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
const quint32 &idTool, QObject *parent = nullptr); const quint32 &idTool, QObject *parent = nullptr);
virtual ~VAbstractNode() {} virtual ~VAbstractNode() {}
@ -55,22 +46,13 @@ public:
virtual void DeleteNode(); virtual void DeleteNode();
virtual void RestoreNode(); virtual void RestoreNode();
protected: protected:
/** /** @brief idNodenode id. */
* @brief idNodenode id.
*/
quint32 idNode; quint32 idNode;
/**
* @brief idTool id tool. /** @brief idTool id tool. */
*/
quint32 idTool; quint32 idTool;
/**
* @brief AddToModeling add tag to modeling tag current pattern peace.
* @param domElement tag.
*/
void AddToModeling(const QDomElement &domElement); void AddToModeling(const QDomElement &domElement);
/**
* @brief decrementReferens decrement reference for all parent objects.
*/
virtual void decrementReferens(); virtual void decrementReferens();
virtual void RemoveReferens(); virtual void RemoveReferens();
virtual void RestoreReferens(); virtual void RestoreReferens();

View File

@ -35,6 +35,17 @@ const QString VNodeArc::TagName = QStringLiteral("arc");
const QString VNodeArc::ToolType = QStringLiteral("modeling"); const QString VNodeArc::ToolType = QStringLiteral("modeling");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VNodeArc constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idArc object id in containerArc.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param qoParent QObject parent
* @param parent parent object.
*/
VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation, VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent) const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent)
:VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent) :VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent)
@ -53,6 +64,17 @@ VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, c
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idArc object id in containerArc.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param parent QObject parent
*/
void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse, void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse,
const Source &typeCreation, const quint32 &idTool, QObject *parent) const Source &typeCreation, const quint32 &idTool, QObject *parent)
{ {
@ -81,12 +103,16 @@ void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief DeleteNode delete node from detail.
*/
void VNodeArc::DeleteNode() void VNodeArc::DeleteNode()
{ {
VAbstractNode::DeleteNode(); VAbstractNode::DeleteNode();
this->setVisible(false); this->setVisible(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeArc::RestoreNode() void VNodeArc::RestoreNode()
{ {
if (this->isVisible() == false) if (this->isVisible() == false)
@ -97,12 +123,18 @@ void VNodeArc::RestoreNode()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VNodeArc::FullUpdateFromFile() void VNodeArc::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VNodeArc::AddToFile() void VNodeArc::AddToFile()
{ {
QDomElement domElement = doc->createElement(TagName); QDomElement domElement = doc->createElement(TagName);
@ -119,6 +151,9 @@ void VNodeArc::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VNodeArc::RefreshDataInFile() void VNodeArc::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -133,6 +168,10 @@ void VNodeArc::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -143,6 +182,10 @@ void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -150,6 +193,10 @@ void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -157,6 +204,9 @@ void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VNodeArc::RefreshGeometry() void VNodeArc::RefreshGeometry()
{ {
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);

View File

@ -40,73 +40,24 @@ class VNodeArc :public VAbstractNode, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
* @brief VNodeArc constructor. const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr);
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idArc object id in containerArc.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param qoParent QObject parent
* @param parent parent object.
*/
VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc,
const Source &typeCreation, const quint32 &idTool = 0,
QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr);
/**
* @brief Create help create tool.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idArc object id in containerArc.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param parent QObject parent
*/
static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse, static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse,
const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr); const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;
/**
* @brief DeleteNode delete node from detail.
*/
virtual void DeleteNode(); virtual void DeleteNode();
virtual void RestoreNode(); virtual void RestoreNode();
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
protected: protected:
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private: private:
/**
* @brief RefreshGeometry refresh item on scene.
*/
void RefreshGeometry(); void RefreshGeometry();
}; };

View File

@ -36,9 +36,19 @@ const QString VNodePoint::TagName = QStringLiteral("point");
const QString VNodePoint::ToolType = QStringLiteral("modeling"); const QString VNodePoint::ToolType = QStringLiteral("modeling");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, /**
const Source &typeCreation, const quint32 &idTool, QObject *qoParent, * @brief VNodePoint constructor.
QGraphicsItem *parent) * @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idPoint object id in containerPoint.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param qoParent QObject parent
* @param parent parent object.
*/
VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation,
const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent)
:VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(0), :VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(0),
namePoint(nullptr), lineName(nullptr) namePoint(nullptr), lineName(nullptr)
{ {
@ -63,9 +73,19 @@ VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPo
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, /**
const Document &parse, const Source &typeCreation, const quint32 &idTool, * @brief Create help create tool.
QObject *parent) * @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idPoint object id in containerPoint.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param parent QObject parent
*/
void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Document &parse,
const Source &typeCreation, const quint32 &idTool, QObject *parent)
{ {
VAbstractTool::AddRecord(id, Tool::NodePoint, doc); VAbstractTool::AddRecord(id, Tool::NodePoint, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
@ -94,12 +114,16 @@ void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idP
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief DeleteNode delete node from detail.
*/
void VNodePoint::DeleteNode() void VNodePoint::DeleteNode()
{ {
VAbstractNode::DeleteNode(); VAbstractNode::DeleteNode();
this->setVisible(false); this->setVisible(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::RestoreNode() void VNodePoint::RestoreNode()
{ {
if (this->isVisible() == false) if (this->isVisible() == false)
@ -110,12 +134,18 @@ void VNodePoint::RestoreNode()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VNodePoint::FullUpdateFromFile() void VNodePoint::FullUpdateFromFile()
{ {
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VNodePoint::AddToFile() void VNodePoint::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -135,6 +165,9 @@ void VNodePoint::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VNodePoint::RefreshDataInFile() void VNodePoint::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -152,6 +185,10 @@ void VNodePoint::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -162,6 +199,10 @@ void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -169,6 +210,10 @@ void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -176,6 +221,10 @@ void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief NameChangePosition label change position.
* @param pos new position.
*/
void VNodePoint::NameChangePosition(const QPointF &pos) void VNodePoint::NameChangePosition(const QPointF &pos)
{ {
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
@ -188,6 +237,11 @@ void VNodePoint::NameChangePosition(const QPointF &pos)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief UpdateNamePosition update label position in file.
* @param mx label bias x axis.
* @param my label bias y axis.
*/
void VNodePoint::UpdateNamePosition(qreal mx, qreal my) void VNodePoint::UpdateNamePosition(qreal mx, qreal my)
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -200,6 +254,10 @@ void VNodePoint::UpdateNamePosition(qreal mx, qreal my)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshPointGeometry refresh point on scene.
* @param point point position.
*/
void VNodePoint::RefreshPointGeometry(const VPointF &point) void VNodePoint::RefreshPointGeometry(const VPointF &point)
{ {
QRectF rec = QRectF(0, 0, radius*2, radius*2); QRectF rec = QRectF(0, 0, radius*2, radius*2);
@ -217,6 +275,9 @@ void VNodePoint::RefreshPointGeometry(const VPointF &point)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshLine refresh label line on scene.
*/
void VNodePoint::RefreshLine() void VNodePoint::RefreshLine()
{ {
QRectF nameRec = namePoint->sceneBoundingRect(); QRectF nameRec = namePoint->sceneBoundingRect();

View File

@ -45,99 +45,36 @@ class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VNodePoint constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idPoint object id in containerPoint.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param qoParent QObject parent
* @param parent parent object.
*/
VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation, VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation,
const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr ); const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr );
/**
* @brief Create help create tool.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idPoint object id in containerPoint.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param parent QObject parent
*/
static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Document &parse, static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Document &parse,
const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr); const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;
/**
* @brief DeleteNode delete node from detail.
*/
virtual void DeleteNode(); virtual void DeleteNode();
virtual void RestoreNode(); virtual void RestoreNode();
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
/**
* @brief NameChangePosition label change position.
* @param pos new position.
*/
void NameChangePosition(const QPointF &pos); void NameChangePosition(const QPointF &pos);
protected: protected:
/** /** @brief radius radius circle. */
* @brief radius radius circle.
*/
qreal radius; qreal radius;
/**
* @brief namePoint label name. /** @brief namePoint label name. */
*/
VGraphicsSimpleTextItem *namePoint; VGraphicsSimpleTextItem *namePoint;
/**
* @brief lineName pointer to label line. /** @brief lineName pointer to label line. */
*/
QGraphicsLineItem *lineName; QGraphicsLineItem *lineName;
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief UpdateNamePosition update label position in file.
* @param mx label bias x axis.
* @param my label bias y axis.
*/
virtual void UpdateNamePosition(qreal mx, qreal my); virtual void UpdateNamePosition(qreal mx, qreal my);
/**
* @brief RefreshPointGeometry refresh point on scene.
* @param point point position.
*/
virtual void RefreshPointGeometry(const VPointF &point); virtual void RefreshPointGeometry(const VPointF &point);
/**
* @brief RefreshLine refresh label line on scene.
*/
void RefreshLine(); void RefreshLine();
private: private:
Q_DISABLE_COPY(VNodePoint) Q_DISABLE_COPY(VNodePoint)

View File

@ -35,6 +35,17 @@ const QString VNodeSpline::TagName = QStringLiteral("spline");
const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline"); const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VNodeSpline constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idSpline object id in containerSpline.
* @param typeCreation way we create this tool.
* @param idTool id node.
* @param qoParent QObject parent.
* @param parent QGraphicsItem parent.
*/
VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
const Source &typeCreation, const quint32 &idTool, QObject *qoParent, const Source &typeCreation, const quint32 &idTool, QObject *qoParent,
QGraphicsItem * parent) QGraphicsItem * parent)
@ -54,9 +65,19 @@ VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 id
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, /**
const Document &parse, const Source &typeCreation, * @brief Create help create tool.
const quint32 &idTool, QObject *parent) * @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idSpline object id in containerSpline.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @param idTool id node.
* @return pointer to node.
*/
VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Document &parse,
const Source &typeCreation, const quint32 &idTool, QObject *parent)
{ {
VAbstractTool::AddRecord(id, Tool::NodeSpline, doc); VAbstractTool::AddRecord(id, Tool::NodeSpline, doc);
VNodeSpline *spl = nullptr; VNodeSpline *spl = nullptr;
@ -85,12 +106,16 @@ VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, qu
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief DeleteNode delete node from detail.
*/
void VNodeSpline::DeleteNode() void VNodeSpline::DeleteNode()
{ {
VAbstractNode::DeleteNode(); VAbstractNode::DeleteNode();
this->setVisible(false); this->setVisible(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSpline::RestoreNode() void VNodeSpline::RestoreNode()
{ {
if (this->isVisible() == false) if (this->isVisible() == false)
@ -101,12 +126,18 @@ void VNodeSpline::RestoreNode()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VNodeSpline::FullUpdateFromFile() void VNodeSpline::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VNodeSpline::AddToFile() void VNodeSpline::AddToFile()
{ {
QDomElement domElement = doc->createElement(TagName); QDomElement domElement = doc->createElement(TagName);
@ -123,6 +154,9 @@ void VNodeSpline::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VNodeSpline::RefreshDataInFile() void VNodeSpline::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -137,6 +171,10 @@ void VNodeSpline::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -147,6 +185,10 @@ void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -154,6 +196,10 @@ void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -161,6 +207,9 @@ void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VNodeSpline::RefreshGeometry() void VNodeSpline::RefreshGeometry()
{ {
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id); const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);

View File

@ -40,73 +40,24 @@ class VNodeSpline:public VAbstractNode, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VNodeSpline constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idSpline object id in containerSpline.
* @param typeCreation way we create this tool.
* @param idTool id node.
* @param qoParent QObject parent.
* @param parent QGraphicsItem parent.
*/
VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation, VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation,
const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr); const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr);
/**
* @brief Create help create tool. static VNodeSpline *Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Document &parse,
* @param doc dom document container. const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr);
* @param data container with variables.
* @param id object id in container.
* @param idSpline object id in containerSpline.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @param idTool id node.
* @return pointer to node.
*/
static VNodeSpline *Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
const Document &parse, const Source &typeCreation,
const quint32 &idTool = 0, QObject *parent = nullptr);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;
/**
* @brief DeleteNode delete node from detail.
*/
virtual void DeleteNode(); virtual void DeleteNode();
virtual void RestoreNode(); virtual void RestoreNode();
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile (); virtual void FullUpdateFromFile ();
protected: protected:
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile (); virtual void AddToFile ();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private: private:
/**
* @brief RefreshGeometry refresh item on scene.
*/
void RefreshGeometry (); void RefreshGeometry ();
}; };

View File

@ -35,6 +35,17 @@ const QString VNodeSplinePath::TagName = QStringLiteral("spline");
const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VNodeSplinePath constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idSpline object id in containerSpline.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param qoParent QObject parent.
* @param parent parent object.
*/
VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
const Source &typeCreation, const quint32 &idTool, QObject *qoParent, const Source &typeCreation, const quint32 &idTool, QObject *qoParent,
QGraphicsItem * parent) QGraphicsItem * parent)
@ -54,9 +65,19 @@ VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, qu
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, /**
const Document &parse, const Source &typeCreation, * @brief Create help create tool.
const quint32 &idTool, QObject *parent) * @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idSpline object id in containerSpline.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param parent QObject parent.
*/
void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Document &parse,
const Source &typeCreation, const quint32 &idTool, QObject *parent)
{ {
VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc); VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
@ -88,12 +109,16 @@ void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint3
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief DeleteNode delete node from detail.
*/
void VNodeSplinePath::DeleteNode() void VNodeSplinePath::DeleteNode()
{ {
VAbstractNode::DeleteNode(); VAbstractNode::DeleteNode();
this->setVisible(false); this->setVisible(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::RestoreNode() void VNodeSplinePath::RestoreNode()
{ {
if (this->isVisible() == false) if (this->isVisible() == false)
@ -104,12 +129,18 @@ void VNodeSplinePath::RestoreNode()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VNodeSplinePath::FullUpdateFromFile() void VNodeSplinePath::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VNodeSplinePath::AddToFile() void VNodeSplinePath::AddToFile()
{ {
QDomElement domElement = doc->createElement(TagName); QDomElement domElement = doc->createElement(TagName);
@ -126,6 +157,9 @@ void VNodeSplinePath::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VNodeSplinePath::RefreshDataInFile() void VNodeSplinePath::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -140,6 +174,10 @@ void VNodeSplinePath::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -150,6 +188,10 @@ void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -157,6 +199,10 @@ void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -164,6 +210,9 @@ void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VNodeSplinePath::RefreshGeometry() void VNodeSplinePath::RefreshGeometry()
{ {
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id); const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);

View File

@ -40,73 +40,23 @@ class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation,
* @brief VNodeSplinePath constructor. const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr);
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idSpline object id in containerSpline.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param qoParent QObject parent.
* @param parent parent object.
*/
VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
const Source &typeCreation, const quint32 &idTool = 0,
QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr);
/**
* @brief Create help create tool.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param idSpline object id in containerSpline.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
* @param idTool tool id.
* @param parent QObject parent.
*/
static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Document &parse, static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Document &parse,
const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = 0); const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = 0);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;
/**
* @brief DeleteNode delete node from detail.
*/
virtual void DeleteNode(); virtual void DeleteNode();
virtual void RestoreNode(); virtual void RestoreNode();
public slots: public slots:
/**
* @brief FullUpdateFromFile update tool data form file.
*/
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
protected: protected:
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private: private:
/**
* @brief RefreshGeometry refresh item on scene.
*/
void RefreshGeometry(); void RefreshGeometry();
}; };

View File

@ -72,6 +72,13 @@ const QString VAbstractTool::TypeLineDashDotLine = QStringLiteral("dashDotLin
const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine"); const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VAbstractTool container.
* @param doc dom document container.
* @param data container with data.
* @param id object id in container.
* @param parent parent object.
*/
VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent) VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent)
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine) :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine)
{ {
@ -82,6 +89,11 @@ VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObjec
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view.
* @param sc scene.
* @param view view.
*/
void VAbstractTool::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view) void VAbstractTool::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view)
{ {
QRectF rect = sc->itemsBoundingRect(); QRectF rect = sc->itemsBoundingRect();
@ -111,6 +123,12 @@ void VAbstractTool::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief LineIntersectRect find point intersection line and rect.
* @param rec rect.
* @param line line.
* @return point intersection.
*/
QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line) QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line)
{ {
qreal x1, y1, x2, y2; qreal x1, y1, x2, y2;
@ -141,6 +159,15 @@ QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief LineIntersectCircle find point intersection line and circle.
* @param center arc center.
* @param radius arc radius.
* @param line line
* @param p1 first intersection point.
* @param p2 second intersection point.
* @return 0 - intersection doesn't exist, 1 - one intersection point, 2 - two intersection points.
*/
qint32 VAbstractTool::LineIntersectCircle(const QPointF &center, qreal radius, const QLineF &line, QPointF &p1, qint32 VAbstractTool::LineIntersectCircle(const QPointF &center, qreal radius, const QLineF &line, QPointF &p1,
QPointF &p2) QPointF &p2)
{ {
@ -177,6 +204,11 @@ qint32 VAbstractTool::LineIntersectCircle(const QPointF &center, qreal radius, c
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosestPoint find point projection of point onto line.
* @param line line.
* @return point on line or extended line if origin size too small.
*/
QPointF VAbstractTool::ClosestPoint(const QLineF &line, const QPointF &point) QPointF VAbstractTool::ClosestPoint(const QLineF &line, const QPointF &point)
{ {
qreal a = 0, b = 0, c = 0; qreal a = 0, b = 0, c = 0;
@ -203,6 +235,10 @@ QPointF VAbstractTool::addVector(const QPointF &p, const QPointF &p1, const QPoi
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief DeleteTool full delete object form scene and file.
* @param tool tool
*/
void VAbstractTool::DeleteTool(QGraphicsItem *tool) void VAbstractTool::DeleteTool(QGraphicsItem *tool)
{ {
if (_referens <= 1) if (_referens <= 1)
@ -254,6 +290,10 @@ void VAbstractTool::DeleteTool(QGraphicsItem *tool)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief LineStyle return pen style for current line style.
* @return pen style.
*/
Qt::PenStyle VAbstractTool::LineStyle() Qt::PenStyle VAbstractTool::LineStyle()
{ {
QStringList styles = Styles(); QStringList styles = Styles();
@ -284,6 +324,13 @@ Qt::PenStyle VAbstractTool::LineStyle()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief LineCoefficients coefficient for equation of segment. Segment equestion ax+by+c=0.
* @param line line
* @param a a value
* @param b b value
* @param c c value
*/
void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c) void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c)
{ {
//coefficient for equation of segment //coefficient for equation of segment
@ -294,6 +341,10 @@ void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qre
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Styles return list of all line styles.
* @return list of all line styles.
*/
const QStringList VAbstractTool::Styles() const QStringList VAbstractTool::Styles()
{ {
//Keep synchronize with DialogTool lineStyles list!!! //Keep synchronize with DialogTool lineStyles list!!!
@ -303,6 +354,12 @@ const QStringList VAbstractTool::Styles()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddRecord add record about tool in history.
* @param id object id in container
* @param toolType tool type
* @param doc dom document container
*/
void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VPattern *doc) void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VPattern *doc)
{ {
quint32 cursor = doc->getCursor(); quint32 cursor = doc->getCursor();

View File

@ -33,6 +33,11 @@
class VPattern; class VPattern;
class QDomElement; class QDomElement;
class QLineF;
class QPointF;
class QGraphicsScene;
class QGraphicsView;
class QRectF;
/** /**
* @brief The VAbstractTool abstract class for all tools. * @brief The VAbstractTool abstract class for all tools.
@ -41,58 +46,15 @@ class VAbstractTool: public VDataTool
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VAbstractTool container.
* @param doc dom document container.
* @param data container with data.
* @param id object id in container.
* @param parent parent object.
*/
VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr); VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr);
virtual ~VAbstractTool(){} virtual ~VAbstractTool(){}
/**
* @brief NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view.
* @param sc scene.
* @param view view.
*/
static void NewSceneRect(QGraphicsScene *sc, QGraphicsView *view); static void NewSceneRect(QGraphicsScene *sc, QGraphicsView *view);
/**
* @brief LineIntersectRect find point intersection line and rect.
* @param rec rect.
* @param line line.
* @return point intersection.
*/
static QPointF LineIntersectRect(QRectF rec, QLineF line); static QPointF LineIntersectRect(QRectF rec, QLineF line);
/**
* @brief LineIntersectCircle find point intersection line and circle.
* @param center arc center.
* @param radius arc radius.
* @param line line
* @param p1 first intersection point.
* @param p2 second intersection point.
* @return 0 - intersection doesn't exist, 1 - one intersection point, 2 - two intersection points.
*/
static qint32 LineIntersectCircle(const QPointF &center, qreal radius, const QLineF &line, QPointF &p1, static qint32 LineIntersectCircle(const QPointF &center, qreal radius, const QLineF &line, QPointF &p1,
QPointF &p2); QPointF &p2);
/**
* @brief ClosestPoint find point projection of point onto line.
* @param line line.
* @return point on line or extended line if origin size too small.
*/
static QPointF ClosestPoint(const QLineF &line, const QPointF &point); static QPointF ClosestPoint(const QLineF &line, const QPointF &point);
static QPointF addVector (const QPointF &p, const QPointF &p1, const QPointF &p2, qreal k); static QPointF addVector (const QPointF &p, const QPointF &p1, const QPointF &p2, qreal k);
/**
* @brief getId return object id.
* @return id.
*/
quint32 getId() const; quint32 getId() const;
/**
* @brief LineCoefficients coefficient for equation of segment. Segment equestion ax+by+c=0.
* @param line line
* @param a a value
* @param b b value
* @param c c value
*/
static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c); static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c);
static const QString AttrType; static const QString AttrType;
static const QString AttrMx; static const QString AttrMx;
@ -133,17 +95,7 @@ public:
static const QString TypeLineDotLine; static const QString TypeLineDotLine;
static const QString TypeLineDashDotLine; static const QString TypeLineDashDotLine;
static const QString TypeLineDashDotDotLine; static const QString TypeLineDashDotDotLine;
/**
* @brief Styles return list of all line styles.
* @return list of all line styles.
*/
static const QStringList Styles(); static const QStringList Styles();
/**
* @brief AddRecord add record about tool in history.
* @param id object id in container
* @param toolType tool type
* @param doc dom document container
*/
static void AddRecord(const quint32 id, const Tool &toolType, VPattern *doc); static void AddRecord(const quint32 id, const Tool &toolType, VPattern *doc);
public slots: public slots:
/** /**
@ -166,25 +118,19 @@ signals:
*/ */
void LiteUpdateTree(); void LiteUpdateTree();
protected: protected:
/** /** @brief doc dom document container */
* @brief doc dom document container
*/
VPattern *doc; VPattern *doc;
/**
* @brief id object id. /** @brief id object id. */
*/
const quint32 id; const quint32 id;
/**
* @brief baseColor base color for tool. /** @brief baseColor base color for tool. */
*/
Qt::GlobalColor baseColor; Qt::GlobalColor baseColor;
/**
* @brief currentColor current tool color. /** @brief currentColor current tool color. */
*/
Qt::GlobalColor currentColor; Qt::GlobalColor currentColor;
/**
* @brief typeLine line type. /** @brief typeLine line type. */
*/
QString typeLine; QString typeLine;
/** /**
* @brief AddToFile add tag with informations about tool into file. * @brief AddToFile add tag with informations about tool into file.
@ -194,34 +140,32 @@ protected:
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/ */
virtual void RefreshDataInFile()=0; virtual void RefreshDataInFile()=0;
/**
* @brief getData return pointer to data container.
* @return container.
*/
const VContainer *getData() const; const VContainer *getData() const;
/** /**
* @brief RemoveReferens decrement value of reference. * @brief RemoveReferens decrement value of reference.
*/ */
virtual void RemoveReferens(){} virtual void RemoveReferens(){}
/**
* @brief DeleteTool full delete object form scene and file.
* @param tool tool
*/
virtual void DeleteTool(QGraphicsItem *tool); virtual void DeleteTool(QGraphicsItem *tool);
/**
* @brief LineStyle return pen style for current line style.
* @return pen style.
*/
Qt::PenStyle LineStyle(); Qt::PenStyle LineStyle();
private: private:
Q_DISABLE_COPY(VAbstractTool) Q_DISABLE_COPY(VAbstractTool)
}; };
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getId return object id.
* @return id.
*/
inline quint32 VAbstractTool::getId() const inline quint32 VAbstractTool::getId() const
{ {
return id; return id;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getData return pointer to data container.
* @return container.
*/
inline const VContainer *VAbstractTool::getData() const inline const VContainer *VAbstractTool::getData() const
{ {
return &data; return &data;

View File

@ -29,12 +29,22 @@
#include "vdatatool.h" #include "vdatatool.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VDataTool constructor.
* @param data container with variables
* @param parent parent object
*/
VDataTool::VDataTool(VContainer *data, QObject *parent): QObject(parent), data(*data), _referens(1) VDataTool::VDataTool(VContainer *data, QObject *parent): QObject(parent), data(*data), _referens(1)
{ {
SCASSERT(data != nullptr); SCASSERT(data != nullptr);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief operator = assignment operator.
* @param tool tool
* @return tool
*/
VDataTool &VDataTool::operator =(const VDataTool &tool) VDataTool &VDataTool::operator =(const VDataTool &tool)
{ {
data = tool.getData(); data = tool.getData();
@ -43,6 +53,9 @@ VDataTool &VDataTool::operator =(const VDataTool &tool)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief decrementReferens decrement referens.
*/
void VDataTool::decrementReferens() void VDataTool::decrementReferens()
{ {
if (_referens > 0) if (_referens > 0)

View File

@ -41,68 +41,56 @@ class VDataTool : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VDataTool constructor.
* @param data container with variables
* @param parent parent object
*/
VDataTool(VContainer *data, QObject *parent = nullptr); VDataTool(VContainer *data, QObject *parent = nullptr);
virtual ~VDataTool(){} virtual ~VDataTool(){}
/**
* @brief operator = assignment operator.
* @param tool tool
* @return tool
*/
VDataTool &operator= (const VDataTool &tool); VDataTool &operator= (const VDataTool &tool);
VContainer getData() const;
void setData(const VContainer *value);
virtual quint32 referens() const;
virtual void incrementReferens();
virtual void decrementReferens();
protected:
/** @brief data container with data */
VContainer data;
/** @brief _referens keep count tools what use this tool. If value more than 1 you can't delete tool. */
quint32 _referens;
};
//---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief getData return data container. * @brief getData return data container.
* @return container. * @return container.
*/ */
VContainer getData() const;
/**
* @brief setData set data container.
* @param value container.
*/
void setData(const VContainer *value);
/**
* @brief referens return count of referens.
* @return count count of referens.
*/
virtual quint32 referens() const;
/**
* @brief incrementReferens increment referens.
*/
virtual void incrementReferens();
/**
* @brief decrementReferens decrement referens.
*/
virtual void decrementReferens();
protected:
/**
* @brief data container with data
*/
VContainer data;
/**
* @brief _referens keep count tools what use this tool. If value more than 1 you can't delete tool.
*/
quint32 _referens;
};
inline VContainer VDataTool::getData() const inline VContainer VDataTool::getData() const
{ {
return data; return data;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setData set data container.
* @param value container.
*/
inline void VDataTool::setData(const VContainer *value) inline void VDataTool::setData(const VContainer *value)
{ {
data = *value; data = *value;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief referens return count of referens.
* @return count count of referens.
*/
inline quint32 VDataTool::referens() const inline quint32 VDataTool::referens() const
{ {
return _referens; return _referens;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief incrementReferens increment referens.
*/
inline void VDataTool::incrementReferens() inline void VDataTool::incrementReferens()
{ {
++_referens; ++_referens;

View File

@ -46,6 +46,18 @@ const QString VToolUnionDetails::NodeTypeContour = QStringLiteral("Contour");
const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling"); const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolUnionDetails costructor.
* @param doc dom document container.
* @param data dom document container.
* @param id object id in container.
* @param d1 first detail.
* @param d2 second detail.
* @param indexD1 index edge in first detail.
* @param indexD2 index edge in second detail.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1,
const VDetail &d2, const quint32 &indexD1, const quint32 &indexD2, const VDetail &d2, const quint32 &indexD1, const quint32 &indexD2,
const Source &typeCreation, QObject *parent) const Source &typeCreation, QObject *parent)
@ -62,6 +74,20 @@ VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const quin
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToNewDetail create united detail adding one node per time.
* @param tool tool that make union.
* @param doc dom document container.
* @param data container with variables.
* @param newDetail united detail.
* @param det detail what we union.
* @param i index node in detail.
* @param idTool id tool union details.
* @param dx bias node x axis.
* @param dy bias node y axis.
* @param pRotate point rotation.
* @param angle angle rotation.
*/
void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail, void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail,
const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx, const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx,
const qreal &dy, const quint32 &pRotate, const qreal &angle) const qreal &dy, const quint32 &pRotate, const qreal &angle)
@ -250,6 +276,18 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief UpdatePoints update data for united details.
* @param idDetail id united detail.
* @param data container with variables.
* @param det detail what we union.
* @param i index node in detail.
* @param idCount count updated or created objects.
* @param dx bias node x axis.
* @param dy bias node y axis.
* @param pRotate point rotation.
* @param angle angle rotation.
*/
void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i,
quint32 &idCount, const qreal &dx, const qreal &dy, const quint32 &pRotate, quint32 &idCount, const qreal &dx, const qreal &dy, const quint32 &pRotate,
const qreal &angle) const qreal &angle)
@ -419,6 +457,14 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief BiasRotatePoint bias and rotate point.
* @param point point.
* @param dx bias x axis.
* @param dy bias y axis.
* @param pRotate point rotation.
* @param angle angle rotation.
*/
void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate, void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate,
const qreal angle) const qreal angle)
{ {
@ -431,6 +477,12 @@ void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const q
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param doc dom document container.
* @param data container with variables.
*/
void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
@ -445,6 +497,21 @@ void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VP
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param d1 first detail.
* @param d2 second detail.
* @param d1id id first detail.
* @param d2id id second detail.
* @param indexD1 index edge in first detail.
* @param indexD2 index edge in second detail.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id,
const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@ -611,6 +678,12 @@ void VToolUnionDetails::FindJ(const qint32 &pointsD2, const VDetail &d2, const q
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetDetailFromFile parse detail from file.
* @param doc dom document container.
* @param domElement tag in xml tree.
* @return detail stored in file.
*/
QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomElement &domElement) QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomElement &domElement)
{ {
QVector<VDetail> vector; QVector<VDetail> vector;
@ -667,6 +740,9 @@ QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomE
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolUnionDetails::AddToFile() void VToolUnionDetails::AddToFile()
{ {
QDomElement domElement = doc->createElement(TagName); QDomElement domElement = doc->createElement(TagName);
@ -683,6 +759,9 @@ void VToolUnionDetails::AddToFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
void VToolUnionDetails::RefreshDataInFile() void VToolUnionDetails::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -698,6 +777,11 @@ void VToolUnionDetails::RefreshDataInFile()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddDetail add detail to xml file.
* @param domElement tag in xml tree.
* @param d detail.
*/
void VToolUnionDetails::AddDetail(QDomElement &domElement, VDetail &d) void VToolUnionDetails::AddDetail(QDomElement &domElement, VDetail &d)
{ {
QDomElement det = doc->createElement(TagDetail); QDomElement det = doc->createElement(TagDetail);
@ -711,6 +795,11 @@ void VToolUnionDetails::AddDetail(QDomElement &domElement, VDetail &d)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddNode add node to xml file.
* @param domElement tag in xml tree.
* @param node node.
*/
void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node) void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node)
{ {
QDomElement nod = doc->createElement(TagNode); QDomElement nod = doc->createElement(TagNode);
@ -769,6 +858,12 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief UpdateDetail update detail in xml tree.
* @param domNode dom node.
* @param d detail.
* @return return next detail tag in xml tree if exist.
*/
QDomNode VToolUnionDetails::UpdateDetail(const QDomNode &domNode, const VDetail &d) QDomNode VToolUnionDetails::UpdateDetail(const QDomNode &domNode, const VDetail &d)
{ {
//QDomNode domNode = domElement.firstChild(); //QDomNode domNode = domElement.firstChild();
@ -795,6 +890,10 @@ QDomNode VToolUnionDetails::UpdateDetail(const QDomNode &domNode, const VDetail
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddToModeling add tool to xml tree.
* @param domElement tag in xml tree.
*/
void VToolUnionDetails::AddToModeling(const QDomElement &domElement) void VToolUnionDetails::AddToModeling(const QDomElement &domElement)
{ {
QDomElement modelingElement; QDomElement modelingElement;

View File

@ -43,18 +43,6 @@ class VToolUnionDetails : public VAbstractTool
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VToolUnionDetails costructor.
* @param doc dom document container.
* @param data dom document container.
* @param id object id in container.
* @param d1 first detail.
* @param d2 second detail.
* @param indexD1 index edge in first detail.
* @param indexD2 index edge in second detail.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, const VDetail &d2, VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, const VDetail &d2,
const quint32 &indexD1, const quint32 &indexD2, const Source &typeCreation, const quint32 &indexD1, const quint32 &indexD2, const Source &typeCreation,
QObject *parent = nullptr); QObject *parent = nullptr);
@ -62,40 +50,13 @@ public:
* @brief setDialog set dialog when user want change tool option. * @brief setDialog set dialog when user want change tool option.
*/ */
virtual void setDialog() {} virtual void setDialog() {}
/**
* @brief Create help create tool from GUI.
* @param dialog dialog.
* @param doc dom document container.
* @param data container with variables.
*/
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param d1 first detail.
* @param d2 second detail.
* @param d1id id first detail.
* @param d2id id second detail.
* @param indexD1 index edge in first detail.
* @param indexD2 index edge in second detail.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id,
const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation); const Source &typeCreation);
static void PointsOnEdge(const VDetail &d, const quint32 &index, VPointF &p1, VPointF &p2, VContainer *data); static void PointsOnEdge(const VDetail &d, const quint32 &index, VPointF &p1, VPointF &p2, VContainer *data);
static void FindJ(const qint32 &pointsD2, const VDetail &d2, const quint32 &indexD2, qint32 &j); static void FindJ(const qint32 &pointsD2, const VDetail &d2, const quint32 &indexD2, qint32 &j);
/**
* @brief GetDetailFromFile parse detail from file.
* @param doc dom document container.
* @param domElement tag in xml tree.
* @return detail stored in file.
*/
static QVector<VDetail> GetDetailFromFile(VPattern *doc, const QDomElement &domElement); static QVector<VDetail> GetDetailFromFile(VPattern *doc, const QDomElement &domElement);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;
@ -107,46 +68,12 @@ public:
static const QString AttrNodeType; static const QString AttrNodeType;
static const QString NodeTypeContour; static const QString NodeTypeContour;
static const QString NodeTypeModeling; static const QString NodeTypeModeling;
/**
* @brief AddToNewDetail create united detail adding one node per time.
* @param tool tool that make union.
* @param doc dom document container.
* @param data container with variables.
* @param newDetail united detail.
* @param det detail what we union.
* @param i index node in detail.
* @param idTool id tool union details.
* @param dx bias node x axis.
* @param dy bias node y axis.
* @param pRotate point rotation.
* @param angle angle rotation.
*/
static void AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail, static void AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail,
const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx = 0, const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx = 0,
const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0); const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0);
/**
* @brief UpdatePoints update data for united details.
* @param idDetail id united detail.
* @param data container with variables.
* @param det detail what we union.
* @param i index node in detail.
* @param idCount count updated or created objects.
* @param dx bias node x axis.
* @param dy bias node y axis.
* @param pRotate point rotation.
* @param angle angle rotation.
*/
static void UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, static void UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i,
quint32 &idCount, const qreal &dx = 0, const qreal &dy = 0, const quint32 &pRotate = 0, quint32 &idCount, const qreal &dx = 0, const qreal &dy = 0, const quint32 &pRotate = 0,
const qreal &angle = 0); const qreal &angle = 0);
/**
* @brief BiasRotatePoint bias and rotate point.
* @param point point.
* @param dx bias x axis.
* @param dy bias y axis.
* @param pRotate point rotation.
* @param angle angle rotation.
*/
static void BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate, static void BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate,
const qreal angle); const qreal angle);
public slots: public slots:
@ -155,55 +82,25 @@ public slots:
*/ */
virtual void FullUpdateFromFile (){} virtual void FullUpdateFromFile (){}
protected: protected:
/**
* @brief AddToFile add tag with informations about tool into file.
*/
virtual void AddToFile(); virtual void AddToFile();
/**
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
*/
virtual void RefreshDataInFile(); virtual void RefreshDataInFile();
private: private:
Q_DISABLE_COPY(VToolUnionDetails) Q_DISABLE_COPY(VToolUnionDetails)
/** /** @brief d1 first detail. */
* @brief d1 first detail.
*/
VDetail d1; VDetail d1;
/**
* @brief d2 second detail. /** @brief d2 second detail. */
*/
VDetail d2; VDetail d2;
/**
* @brief indexD1 index edge in first detail. /** @brief indexD1 index edge in first detail. */
*/
quint32 indexD1; quint32 indexD1;
/**
* @brief indexD2 index edge in second detail. /** @brief indexD2 index edge in second detail. */
*/
quint32 indexD2; quint32 indexD2;
/**
* @brief AddDetail add detail to xml file.
* @param domElement tag in xml tree.
* @param d detail.
*/
void AddDetail(QDomElement &domElement, VDetail &d); void AddDetail(QDomElement &domElement, VDetail &d);
/**
* @brief AddNode add node to xml file.
* @param domElement tag in xml tree.
* @param node node.
*/
void AddNode(QDomElement &domElement, const VNodeDetail &node); void AddNode(QDomElement &domElement, const VNodeDetail &node);
/**
* @brief UpdateDetail update detail in xml tree.
* @param domNode dom node.
* @param d detail.
* @return return next detail tag in xml tree if exist.
*/
QDomNode UpdateDetail(const QDomNode &domNode, const VDetail &d); QDomNode UpdateDetail(const QDomNode &domNode, const VDetail &d);
/**
* @brief AddToModeling add tool to xml tree.
* @param domElement tag in xml tree.
*/
void AddToModeling(const QDomElement &domElement); void AddToModeling(const QDomElement &domElement);
}; };

View File

@ -31,6 +31,14 @@
#include "../options.h" #include "../options.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and
* style option are used to control how the editor widget appears.
* @param parent parent widget.
* @param option item options.
* @param index index of data item.
* @return editor to be used for editing the data item.
*/
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index ) const const QModelIndex &index ) const
@ -45,6 +53,12 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setEditorData sets the data to be displayed and edited by the editor from the data model item specified by
* the model index.
* @param editor editor.
* @param index index of data item.
*/
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{ {
@ -56,6 +70,12 @@ void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &in
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setModelData gets data from the editor widget and stores it in the specified model at the item index.
* @param editor editor.
* @param model model.
* @param index index of data item.
*/
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{ {
@ -68,6 +88,13 @@ void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *mo
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief updateEditorGeometry updates the editor for the item specified by index according to the style option
* given.
* @param editor editor.
* @param option item options.
* @param index index of data item.
*/
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
const QModelIndex &index) const const QModelIndex &index) const
@ -77,6 +104,9 @@ void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOp
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief commitAndCloseEditor commit value if changed.
*/
void DoubleSpinBoxDelegate::commitAndCloseEditor() void DoubleSpinBoxDelegate::commitAndCloseEditor()
{ {
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender()); QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());

View File

@ -44,46 +44,14 @@ public:
* @param parent parent object. * @param parent parent object.
*/ */
DoubleSpinBoxDelegate(QObject *parent = nullptr): QItemDelegate(parent), lastValue(-10001.0){} DoubleSpinBoxDelegate(QObject *parent = nullptr): QItemDelegate(parent), lastValue(-10001.0){}
/**
* @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and
* style option are used to control how the editor widget appears.
* @param parent parent widget.
* @param option item options.
* @param index index of data item.
* @return editor to be used for editing the data item.
*/
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
/**
* @brief setEditorData sets the data to be displayed and edited by the editor from the data model item specified by
* the model index.
* @param editor editor.
* @param index index of data item.
*/
void setEditorData(QWidget *editor, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const;
/**
* @brief setModelData gets data from the editor widget and stores it in the specified model at the item index.
* @param editor editor.
* @param model model.
* @param index index of data item.
*/
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
/**
* @brief updateEditorGeometry updates the editor for the item specified by index according to the style option
* given.
* @param editor editor.
* @param option item options.
* @param index index of data item.
*/
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
public slots: public slots:
/**
* @brief commitAndCloseEditor commit value if changed.
*/
void commitAndCloseEditor(); void commitAndCloseEditor();
private: private:
/** /** @brief lastValue last saved value. */
* @brief lastValue last saved value.
*/
qreal lastValue; qreal lastValue;
}; };

View File

@ -31,6 +31,10 @@
#include "../options.h" #include "../options.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief TextDelegate constructor.
* @param parent parent widget.
*/
TextDelegate::TextDelegate(const QString &regex, QObject *parent): QItemDelegate(parent), lastText(QString("Name_")), TextDelegate::TextDelegate(const QString &regex, QObject *parent): QItemDelegate(parent), lastText(QString("Name_")),
regex(regex) regex(regex)
{ {
@ -39,6 +43,14 @@ TextDelegate::TextDelegate(const QString &regex, QObject *parent): QItemDelegate
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and
* style option are used to control how the editor widget appears.
* @param parent parent widget.
* @param option item options.
* @param index index of data item.
* @return editor to be used for editing the data item.
*/
QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
Q_UNUSED(option); Q_UNUSED(option);
@ -51,6 +63,12 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setEditorData sets the data to be displayed and edited by the editor from the data model item specified by
* the model index.
* @param editor editor.
* @param index index of data item.
*/
void TextDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const void TextDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{ {
QString text = index.model()->data(index, Qt::EditRole).toString(); QString text = index.model()->data(index, Qt::EditRole).toString();
@ -66,6 +84,12 @@ void TextDelegate::setEditorData(QWidget *editor, const QModelIndex &index) cons
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setModelData gets data from the editor widget and stores it in the specified model at the item index.
* @param editor editor.
* @param model model.
* @param index index of data item.
*/
void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{ {
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor); QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
@ -80,6 +104,13 @@ void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, cons
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief updateEditorGeometry updates the editor for the item specified by index according to the style option
* given.
* @param editor editor.
* @param option item options.
* @param index index of data item.
*/
void TextDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, void TextDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
const QModelIndex &index) const const QModelIndex &index) const
{ {
@ -88,6 +119,9 @@ void TextDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewI
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief commitAndCloseEditor commit value if changed.
*/
void TextDelegate::commitAndCloseEditor() void TextDelegate::commitAndCloseEditor()
{ {
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender()); QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender());
@ -107,6 +141,10 @@ void TextDelegate::commitAndCloseEditor()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief InitText initialize text.
* @param text text.
*/
void TextDelegate::InitText(const QString &text) void TextDelegate::InitText(const QString &text)
{ {
lastText = text; lastText = text;

View File

@ -39,41 +39,10 @@ class TextDelegate : public QItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief TextDelegate constructor.
* @param parent parent widget.
*/
TextDelegate(const QString &regex, QObject *parent = nullptr); TextDelegate(const QString &regex, QObject *parent = nullptr);
/**
* @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and
* style option are used to control how the editor widget appears.
* @param parent parent widget.
* @param option item options.
* @param index index of data item.
* @return editor to be used for editing the data item.
*/
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
/**
* @brief setEditorData sets the data to be displayed and edited by the editor from the data model item specified by
* the model index.
* @param editor editor.
* @param index index of data item.
*/
void setEditorData(QWidget *editor, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const;
/**
* @brief setModelData gets data from the editor widget and stores it in the specified model at the item index.
* @param editor editor.
* @param model model.
* @param index index of data item.
*/
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
/**
* @brief updateEditorGeometry updates the editor for the item specified by index according to the style option
* given.
* @param editor editor.
* @param option item options.
* @param index index of data item.
*/
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
signals: signals:
/** /**
@ -82,19 +51,10 @@ signals:
*/ */
void SaveText(const QString &text) const; void SaveText(const QString &text) const;
public slots: public slots:
/**
* @brief commitAndCloseEditor commit value if changed.
*/
void commitAndCloseEditor(); void commitAndCloseEditor();
/**
* @brief InitText initialize text.
* @param text text.
*/
void InitText(const QString &text); void InitText(const QString &text);
private: private:
/** /** @brief lastValue last saved value. */
* @brief lastValue last saved value.
*/
QString lastText; QString lastText;
QString regex; QString regex;
}; };

View File

@ -49,6 +49,11 @@ const qreal VApplication::PrintDPI = 96.0;
#define DefWidth 1.2//mm #define DefWidth 1.2//mm
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VApplication constructor.
* @param argc number arguments.
* @param argv command line.
*/
VApplication::VApplication(int &argc, char **argv) VApplication::VApplication(int &argc, char **argv)
: QApplication(argc, argv), _patternUnit(Unit::Cm), _patternType(MeasurementsType::Individual), : QApplication(argc, argv), _patternUnit(Unit::Cm), _patternType(MeasurementsType::Individual),
_widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0), measurements(QMap<QString, VTranslation>()), _widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0), measurements(QMap<QString, VTranslation>()),
@ -66,6 +71,12 @@ VApplication::VApplication(int &argc, char **argv)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief notify Reimplemented from QApplication::notify().
* @param receiver receiver.
* @param event event.
* @return value that is returned from the receiver's event handler.
*/
// reimplemented from QApplication so we can throw exceptions in slots // reimplemented from QApplication so we can throw exceptions in slots
bool VApplication::notify(QObject *receiver, QEvent *event) bool VApplication::notify(QObject *receiver, QEvent *event)
{ {

View File

@ -49,19 +49,8 @@ class VApplication : public QApplication
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VApplication constructor.
* @param argc number arguments.
* @param argv command line.
*/
VApplication(int &argc, char ** argv); VApplication(int &argc, char ** argv);
virtual ~VApplication() {} virtual ~VApplication() {}
/**
* @brief notify Reimplemented from QApplication::notify().
* @param receiver receiver.
* @param event event.
* @return value that is returned from the receiver's event handler.
*/
virtual bool notify(QObject * receiver, QEvent * event); virtual bool notify(QObject * receiver, QEvent * event);
Unit patternUnit() const; Unit patternUnit() const;
void setPatternUnit(const Unit &patternUnit); void setPatternUnit(const Unit &patternUnit);
@ -108,8 +97,7 @@ private:
void InitVariables(); void InitVariables();
void InitFunctions(); void InitFunctions();
void InitPostfixOperators(); void InitPostfixOperators();
bool MeasurementsFromUser(QString &newFormula, int position, const QString &token, bool MeasurementsFromUser(QString &newFormula, int position, const QString &token, int &bias) const;
int &bias) const;
bool VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const; bool VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const;
bool PostfixOperatorsFromUser(QString &newFormula, int position, const QString &token, bool PostfixOperatorsFromUser(QString &newFormula, int position, const QString &token,
int &bias) const; int &bias) const;

View File

@ -33,6 +33,14 @@
#include "../widgets/vapplication.h" #include "../widgets/vapplication.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VControlPointSpline constructor.
* @param indexSpline index spline in list.
* @param position position point in spline.
* @param controlPoint control point.
* @param splinePoint spline point.
* @param parent parent object.
*/
VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position, VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position,
const QPointF &controlPoint, const QPointF &splinePoint, const QPointF &controlPoint, const QPointF &splinePoint,
QGraphicsItem *parent) QGraphicsItem *parent)
@ -59,6 +67,10 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePointP
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -73,6 +85,12 @@ void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemChange handle item change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == ItemPositionChange && scene()) if (change == ItemPositionChange && scene())
@ -85,6 +103,13 @@ QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange chang
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshLine refresh line control point.
* @param indexSpline index spline in list.
* @param pos position point in spline.
* @param controlPoint control point.
* @param splinePoint spline point.
*/
void VControlPointSpline::RefreshLine(const qint32 &indexSpline, SplinePointPosition pos, void VControlPointSpline::RefreshLine(const qint32 &indexSpline, SplinePointPosition pos,
const QPointF &controlPoint, const QPointF &splinePoint) const QPointF &controlPoint, const QPointF &splinePoint)
{ {
@ -97,6 +122,10 @@ void VControlPointSpline::RefreshLine(const qint32 &indexSpline, SplinePointPosi
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setEnabledPoint disable or enable control point.
* @param enable true - enable.
*/
void VControlPointSpline::setEnabledPoint(bool enable) void VControlPointSpline::setEnabledPoint(bool enable)
{ {
if (enable == true) if (enable == true)

View File

@ -40,17 +40,8 @@ class VControlPointSpline : public QObject, public QGraphicsEllipseItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position, const QPointF &controlPoint,
* @brief VControlPointSpline constructor. const QPointF &splinePoint, QGraphicsItem * parent = nullptr);
* @param indexSpline index spline in list.
* @param position position point in spline.
* @param controlPoint control point.
* @param splinePoint spline point.
* @param parent parent object.
*/
VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position,
const QPointF &controlPoint, const QPointF &splinePoint,
QGraphicsItem * parent = nullptr);
signals: signals:
/** /**
* @brief ControlPointChangePosition emit when control point change position. * @brief ControlPointChangePosition emit when control point change position.
@ -61,55 +52,25 @@ signals:
void ControlPointChangePosition(const qint32 &indexSpline, SplinePointPosition position, void ControlPointChangePosition(const qint32 &indexSpline, SplinePointPosition position,
const QPointF pos); const QPointF pos);
public slots: public slots:
/**
* @brief RefreshLine refresh line control point.
* @param indexSpline index spline in list.
* @param pos position point in spline.
* @param controlPoint control point.
* @param splinePoint spline point.
*/
void RefreshLine(const qint32 &indexSpline, SplinePointPosition pos, const QPointF &controlPoint, void RefreshLine(const qint32 &indexSpline, SplinePointPosition pos, const QPointF &controlPoint,
const QPointF &splinePoint); const QPointF &splinePoint);
/**
* @brief setEnabledPoint disable or enable control point.
* @param enable true - enable.
*/
void setEnabledPoint(bool enable); void setEnabledPoint(bool enable);
protected: protected:
/** /** @brief radius radius circle. */
* @brief radius radius circle.
*/
qreal radius; qreal radius;
/**
* @brief controlLine pointer to line control point. /** @brief controlLine pointer to line control point. */
*/
QGraphicsLineItem *controlLine; QGraphicsLineItem *controlLine;
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief itemChange handle item change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
private: private:
Q_DISABLE_COPY(VControlPointSpline) Q_DISABLE_COPY(VControlPointSpline)
/** /** @brief indexSpline index spline in list.. */
* @brief indexSpline index spline in list..
*/
qint32 indexSpline; qint32 indexSpline;
/**
* @brief position position point in spline. /** @brief position position point in spline. */
*/
SplinePointPosition position; SplinePointPosition position;
}; };

View File

@ -29,6 +29,10 @@
#include "vgraphicssimpletextitem.h" #include "vgraphicssimpletextitem.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VGraphicsSimpleTextItem default constructor.
* @param parent parent object.
*/
VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent) VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent)
:QGraphicsSimpleTextItem(parent), fontSize(0) :QGraphicsSimpleTextItem(parent), fontSize(0)
{ {
@ -43,6 +47,11 @@ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VGraphicsSimpleTextItem constructor.
* @param text text.
* @param parent parent object.
*/
VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent ) VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent )
:QGraphicsSimpleTextItem(text, parent), fontSize(0) :QGraphicsSimpleTextItem(text, parent), fontSize(0)
{ {
@ -53,6 +62,12 @@ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphic
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemChange handle item change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QVariant &value) QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
if (change == ItemPositionChange && scene()) if (change == ItemPositionChange && scene())
@ -64,6 +79,10 @@ QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QV
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VGraphicsSimpleTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VGraphicsSimpleTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -71,6 +90,10 @@ void VGraphicsSimpleTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -78,6 +101,10 @@ void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VGraphicsSimpleTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VGraphicsSimpleTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
emit ShowContextMenu(event); emit ShowContextMenu(event);

View File

@ -39,16 +39,9 @@ class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VGraphicsSimpleTextItem default constructor.
* @param parent parent object.
*/
VGraphicsSimpleTextItem(QGraphicsItem * parent = nullptr); VGraphicsSimpleTextItem(QGraphicsItem * parent = nullptr);
/**
* @brief VGraphicsSimpleTextItem constructor.
* @param text text.
* @param parent parent object.
*/
VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent = nullptr ); VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent = nullptr );
/** /**
* @brief FontSize return label font size. * @brief FontSize return label font size.
@ -67,32 +60,12 @@ signals:
*/ */
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/**
* @brief itemChange handle item change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
private: private:
/** /** @brief fontSize label font size. */
* @brief fontSize label font size.
*/
qint32 fontSize; qint32 fontSize;
}; };

View File

@ -33,20 +33,37 @@
#include "../widgets/vapplication.h" #include "../widgets/vapplication.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VItem constructor.
* @param path detail path.
* @param numInList index in list of details.
* @param parent parent object.
*/
VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent ) VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent )
:QGraphicsPathItem ( path, parent ), numInOutList(numInList), paper(nullptr) :QGraphicsPathItem ( path, parent ), numInOutList(numInList), paper(nullptr)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VItem default constructor.
*/
VItem::VItem():numInOutList(0), paper(nullptr) VItem::VItem():numInOutList(0), paper(nullptr)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VItem constructor.
* @param numInList index in list of details.
* @param parent parent object.
*/
VItem::VItem(int numInList, QGraphicsItem *parent):QGraphicsPathItem (parent), numInOutList(numInList), VItem::VItem(int numInList, QGraphicsItem *parent):QGraphicsPathItem (parent), numInOutList(numInList),
paper(nullptr) paper(nullptr)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief checkItemChange change item change. If detail create colission or moved out paper emit signal.
*/
void VItem::checkItemChange() void VItem::checkItemChange()
{ {
QRectF rect; QRectF rect;
@ -87,6 +104,12 @@ void VItem::checkItemChange()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemChange handle item change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant VItem::itemChange( GraphicsItemChange change, const QVariant &value ) QVariant VItem::itemChange( GraphicsItemChange change, const QVariant &value )
{ {
if ( change == QGraphicsItem::ItemPositionHasChanged && scene() ) if ( change == QGraphicsItem::ItemPositionHasChanged && scene() )
@ -103,6 +126,9 @@ QVariant VItem::itemChange( GraphicsItemChange change, const QVariant &value )
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief LengthChanged handle signal change paper length.
*/
void VItem::LengthChanged() void VItem::LengthChanged()
{ {
checkItemChange(); checkItemChange();

View File

@ -39,28 +39,9 @@ class VItem : public QObject, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VItem default constructor.
*/
VItem (); VItem ();
/**
* @brief VItem constructor.
* @param numInList index in list of details.
* @param parent parent object.
*/
VItem (int numInList, QGraphicsItem * parent = nullptr); VItem (int numInList, QGraphicsItem * parent = nullptr);
/**
* @brief VItem constructor.
* @param path detail path.
* @param numInList index in list of details.
* @param parent parent object.
*/
VItem ( const QPainterPath & path, int numInList, QGraphicsItem * parent = nullptr ); VItem ( const QPainterPath & path, int numInList, QGraphicsItem * parent = nullptr );
/**
* @brief Rotate rotate detail on angle in degree.
* @param angle angle in degree.
*/
void Rotate ( qreal angle );
/** /**
* @brief getPaper return pointer to paper sheet. * @brief getPaper return pointer to paper sheet.
* @return pointer to paper sheet. * @return pointer to paper sheet.
@ -72,36 +53,17 @@ public:
*/ */
void setPaper(QGraphicsRectItem *value) {paper = value;} void setPaper(QGraphicsRectItem *value) {paper = value;}
public slots: public slots:
/**
* @brief LengthChanged handle signal change paper length.
*/
void LengthChanged(); void LengthChanged();
/**
* @brief SetIndexInList set detail index in list.
* @param index index in list.
*/
void SetIndexInList( qint32 index ); void SetIndexInList( qint32 index );
protected: protected:
/**
* @brief itemChange handle item change.
* @param change change.
* @param value value.
* @return value.
*/
QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
/**
* @brief checkItemChange change item change. If detail create colission or moved out paper emit signal.
*/
void checkItemChange (); void checkItemChange ();
private: private:
Q_DISABLE_COPY(VItem) Q_DISABLE_COPY(VItem)
/** /** @brief numInOutList index in list. */
* @brief numInOutList index in list.
*/
qint32 numInOutList; qint32 numInOutList;
/**
* @brief paper pointer to paper item. /** @brief paper pointer to paper item. */
*/
QGraphicsRectItem* paper; QGraphicsRectItem* paper;
signals: signals:
/** /**
@ -118,6 +80,11 @@ signals:
void itemColliding ( QList<QGraphicsItem *> list, int number ); void itemColliding ( QList<QGraphicsItem *> list, int number );
}; };
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetIndexInList set detail index in list.
* @param index index in list.
*/
inline void VItem::SetIndexInList(qint32 index) inline void VItem::SetIndexInList(qint32 index)
{ {
numInOutList = index; numInOutList = index;

View File

@ -29,16 +29,28 @@
#include "vmaingraphicsscene.h" #include "vmaingraphicsscene.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VMainGraphicsScene default constructor.
*/
VMainGraphicsScene::VMainGraphicsScene() VMainGraphicsScene::VMainGraphicsScene()
:QGraphicsScene(), horScrollBar(0), verScrollBar(0), scaleFactor(1), _transform(QTransform()) :QGraphicsScene(), horScrollBar(0), verScrollBar(0), scaleFactor(1), _transform(QTransform())
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VMainGraphicsScene constructor.
* @param sceneRect scene rect.
* @param parent parent object.
*/
VMainGraphicsScene::VMainGraphicsScene(const QRectF & sceneRect, QObject * parent) VMainGraphicsScene::VMainGraphicsScene(const QRectF & sceneRect, QObject * parent)
:QGraphicsScene ( sceneRect, parent ), horScrollBar(0), verScrollBar(0), scaleFactor(1), _transform(QTransform()) :QGraphicsScene ( sceneRect, parent ), horScrollBar(0), verScrollBar(0), scaleFactor(1), _transform(QTransform())
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseMoveEvent handle mouse move events.
* @param event mouse move event.
*/
void VMainGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event) void VMainGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{ {
emit mouseMove(event->scenePos()); emit mouseMove(event->scenePos());
@ -46,6 +58,10 @@ void VMainGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mousePressEvent mouse press events.
* @param event mouse press event
*/
void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event) void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
emit mousePress(event->scenePos()); emit mousePress(event->scenePos());
@ -53,24 +69,41 @@ void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief transform return view transformation.
* @return view transformation.
*/
QTransform VMainGraphicsScene::transform() const QTransform VMainGraphicsScene::transform() const
{ {
return _transform; return _transform;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief setTransform set view transformation.
* @param transform view transformation.
*/
void VMainGraphicsScene::setTransform(const QTransform &transform) void VMainGraphicsScene::setTransform(const QTransform &transform)
{ {
_transform = transform; _transform = transform;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChoosedItem emit ChoosedObject signal.
* @param id object id.
* @param type object scene type.
*/
void VMainGraphicsScene::ChoosedItem(quint32 id, const SceneObject &type) void VMainGraphicsScene::ChoosedItem(quint32 id, const SceneObject &type)
{ {
emit ChoosedObject(id, type); emit ChoosedObject(id, type);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor. scene scale factor.
*/
void VMainGraphicsScene::SetFactor(qreal factor) void VMainGraphicsScene::SetFactor(qreal factor)
{ {
scaleFactor=scaleFactor*factor; scaleFactor=scaleFactor*factor;

View File

@ -39,68 +39,19 @@ class VMainGraphicsScene : public QGraphicsScene
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VMainGraphicsScene default constructor.
*/
VMainGraphicsScene(); VMainGraphicsScene();
/**
* @brief VMainGraphicsScene constructor.
* @param sceneRect scene rect.
* @param parent parent object.
*/
VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = nullptr); VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = nullptr);
/**
* @brief getHorScrollBar return scene horizontal scrollbar.
* @return horizontal scrollbar.
*/
qint32 getHorScrollBar() const; qint32 getHorScrollBar() const;
/**
* @brief setHorScrollBar set scene horizontal scrollbar.
* @param value horizontal scrollbar.
*/
void setHorScrollBar(const qint32 &value); void setHorScrollBar(const qint32 &value);
/**
* @brief getVerScrollBar return scene vertical scrollbar.
* @return vertical scrollbar.
*/
qint32 getVerScrollBar() const; qint32 getVerScrollBar() const;
/**
* @brief setVerScrollBar set scene vertical scrollbar.
* @param value vertical scrollbar.
*/
void setVerScrollBar(const qint32 &value); void setVerScrollBar(const qint32 &value);
/**
* @brief transform return view transformation.
* @return view transformation.
*/
QTransform transform() const; QTransform transform() const;
/**
* @brief setTransform set view transformation.
* @param transform view transformation.
*/
void setTransform(const QTransform &transform); void setTransform(const QTransform &transform);
public slots: public slots:
/**
* @brief ChoosedItem emit ChoosedObject signal.
* @param id object id.
* @param type object scene type.
*/
void ChoosedItem(quint32 id, const SceneObject &type); void ChoosedItem(quint32 id, const SceneObject &type);
/**
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor. scene scale factor.
*/
void SetFactor(qreal factor); void SetFactor(qreal factor);
protected: protected:
/**
* @brief mouseMoveEvent handle mouse move events.
* @param event mouse move event.
*/
void mouseMoveEvent(QGraphicsSceneMouseEvent* event); void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
/**
* @brief mousePressEvent mouse press events.
* @param event mouse press event
*/
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event);
signals: signals:
/** /**
@ -125,39 +76,54 @@ signals:
*/ */
void NewFactor(qreal factor); void NewFactor(qreal factor);
private: private:
/** /** @brief horScrollBar value horizontal scroll bar. */
* @brief horScrollBar value horizontal scroll bar.
*/
qint32 horScrollBar; qint32 horScrollBar;
/**
* @brief verScrollBar value vertical scroll bar. /** @brief verScrollBar value vertical scroll bar. */
*/
qint32 verScrollBar; qint32 verScrollBar;
/**
* @brief scaleFactor scale factor. /** @brief scaleFactor scale factor. */
*/
qreal scaleFactor; qreal scaleFactor;
/**
* @brief _transform view transform value. /** @brief _transform view transform value. */
*/
QTransform _transform; QTransform _transform;
}; };
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getHorScrollBar return scene horizontal scrollbar.
* @return horizontal scrollbar.
*/
inline qint32 VMainGraphicsScene::getHorScrollBar() const inline qint32 VMainGraphicsScene::getHorScrollBar() const
{ {
return horScrollBar; return horScrollBar;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setHorScrollBar set scene horizontal scrollbar.
* @param value horizontal scrollbar.
*/
inline void VMainGraphicsScene::setHorScrollBar(const qint32 &value) inline void VMainGraphicsScene::setHorScrollBar(const qint32 &value)
{ {
horScrollBar = value; horScrollBar = value;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getVerScrollBar return scene vertical scrollbar.
* @return vertical scrollbar.
*/
inline qint32 VMainGraphicsScene::getVerScrollBar() const inline qint32 VMainGraphicsScene::getVerScrollBar() const
{ {
return verScrollBar; return verScrollBar;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setVerScrollBar set scene vertical scrollbar.
* @param value vertical scrollbar.
*/
inline void VMainGraphicsScene::setVerScrollBar(const qint32 &value) inline void VMainGraphicsScene::setVerScrollBar(const qint32 &value)
{ {
verScrollBar = value; verScrollBar = value;

View File

@ -35,6 +35,10 @@
#include "../tools/vabstracttool.h" #include "../tools/vabstracttool.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VMainGraphicsView constructor.
* @param parent parent object.
*/
VMainGraphicsView::VMainGraphicsView(QWidget *parent) VMainGraphicsView::VMainGraphicsView(QWidget *parent)
:QGraphicsView(parent), _numScheduledScalings(0) :QGraphicsView(parent), _numScheduledScalings(0)
{ {
@ -44,6 +48,10 @@ VMainGraphicsView::VMainGraphicsView(QWidget *parent)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief wheelEvent handle wheel events.
* @param event wheel event.
*/
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void VMainGraphicsView::wheelEvent(QWheelEvent *event) void VMainGraphicsView::wheelEvent(QWheelEvent *event)
{ {
@ -71,6 +79,10 @@ void VMainGraphicsView::wheelEvent(QWheelEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief scalingTime call each time when need handle scaling.
* @param x value from 0.0 to 1.0
*/
void VMainGraphicsView::scalingTime(qreal x) void VMainGraphicsView::scalingTime(qreal x)
{ {
Q_UNUSED(x); Q_UNUSED(x);
@ -90,6 +102,10 @@ void VMainGraphicsView::scalingTime(qreal x)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief scrollingTime call each time when need handle scrolling.
* @param x value from 0.0 to 1.0
*/
void VMainGraphicsView::scrollingTime(qreal x) void VMainGraphicsView::scrollingTime(qreal x)
{ {
Q_UNUSED(x); Q_UNUSED(x);
@ -110,6 +126,9 @@ void VMainGraphicsView::scrollingTime(qreal x)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief animFinished
*/
void VMainGraphicsView::animFinished() void VMainGraphicsView::animFinished()
{ {
if (_numScheduledScalings > 0) if (_numScheduledScalings > 0)
@ -140,6 +159,10 @@ void VMainGraphicsView::ZoomOut()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mousePressEvent handle mouse press events.
* @param mousePress mouse press event.
*/
void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress) void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress)
{ {
if (mousePress->button() & Qt::LeftButton) if (mousePress->button() & Qt::LeftButton)
@ -158,6 +181,10 @@ void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VMainGraphicsView::mouseReleaseEvent(QMouseEvent *event) void VMainGraphicsView::mouseReleaseEvent(QMouseEvent *event)
{ {
QGraphicsView::mouseReleaseEvent ( event ); QGraphicsView::mouseReleaseEvent ( event );

View File

@ -38,10 +38,7 @@ class VMainGraphicsView : public QGraphicsView
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VMainGraphicsView constructor.
* @param parent parent object.
*/
explicit VMainGraphicsView(QWidget *parent = nullptr); explicit VMainGraphicsView(QWidget *parent = nullptr);
signals: signals:
/** /**
@ -50,42 +47,17 @@ signals:
*/ */
void NewFactor(qreal factor); void NewFactor(qreal factor);
public slots: public slots:
/**
* @brief scalingTime call each time when need handle scaling.
* @param x value from 0.0 to 1.0
*/
void scalingTime(qreal x); void scalingTime(qreal x);
/**
* @brief scrollingTime call each time when need handle scrolling.
* @param x value from 0.0 to 1.0
*/
void scrollingTime(qreal x); void scrollingTime(qreal x);
/**
* @brief animFinished
*/
void animFinished(); void animFinished();
void ZoomIn(); void ZoomIn();
void ZoomOut(); void ZoomOut();
protected: protected:
/**
* @brief wheelEvent handle wheel events.
* @param event wheel event.
*/
void wheelEvent ( QWheelEvent * event ); void wheelEvent ( QWheelEvent * event );
/**
* @brief mousePressEvent handle mouse press events.
* @param mousePress mouse press event.
*/
void mousePressEvent(QMouseEvent *mousePress); void mousePressEvent(QMouseEvent *mousePress);
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event);
private: private:
/** /** @brief _numScheduledScalings keep number scheduled scalings. */
* @brief _numScheduledScalings keep number scheduled scalings.
*/
qint32 _numScheduledScalings; qint32 _numScheduledScalings;
}; };

View File

@ -32,6 +32,13 @@
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VSimpleArc constructor.
* @param id arc id.
* @param currentColor current color.
* @param factor scale factor.
* @param parent parent object.
*/
VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent)
:QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor)
{ {
@ -48,6 +55,10 @@ VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VSimpleArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -58,6 +69,10 @@ void VSimpleArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -72,6 +87,10 @@ void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);

View File

@ -40,13 +40,6 @@ class VSimpleArc : public QObject, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VSimpleArc constructor.
* @param id arc id.
* @param currentColor current color.
* @param factor scale factor.
* @param parent parent object.
*/
VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = nullptr); VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = nullptr);
signals: signals:
/** /**
@ -55,34 +48,18 @@ signals:
*/ */
void Choosed(quint32 id); void Choosed(quint32 id);
protected: protected:
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private: private:
Q_DISABLE_COPY(VSimpleArc) Q_DISABLE_COPY(VSimpleArc)
/** /** @brief id arc id. */
* @brief id arc id.
*/
quint32 id; quint32 id;
/**
* @brief factor scale factor. /** @brief factor scale factor. */
*/
qreal *factor; qreal *factor;
/**
* @brief currentColor current color. /** @brief currentColor current color. */
*/
Qt::GlobalColor *currentColor; Qt::GlobalColor *currentColor;
}; };

View File

@ -32,6 +32,13 @@
#include <QPen> #include <QPen>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VSimpleSpline constructor.
* @param id spline id.
* @param factor scene scale factor.
* @param currentColor current color.
* @param parent parent object.
*/
VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent)
:QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor)
{ {
@ -56,6 +63,10 @@ void VSimpleSpline::ChangedActivDraw(const bool &flag)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -66,6 +77,10 @@ void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -80,6 +95,10 @@ void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);

View File

@ -40,13 +40,6 @@ class VSimpleSpline : public QObject, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VSimpleSpline constructor.
* @param id spline id.
* @param factor scene scale factor.
* @param currentColor current color.
* @param parent parent object.
*/
VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = 0); VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = 0);
void ChangedActivDraw(const bool &flag); void ChangedActivDraw(const bool &flag);
signals: signals:
@ -56,34 +49,18 @@ signals:
*/ */
void Choosed(quint32 id); void Choosed(quint32 id);
protected: protected:
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private: private:
Q_DISABLE_COPY(VSimpleSpline) Q_DISABLE_COPY(VSimpleSpline)
/** /** @brief id spline id. */
* @brief id spline id.
*/
quint32 id; quint32 id;
/**
* @brief factor scale factor. /** @brief factor scale factor. */
*/
qreal *factor; qreal *factor;
/**
* @brief currentColor current color. /** @brief currentColor current color. */
*/
Qt::GlobalColor *currentColor; Qt::GlobalColor *currentColor;
}; };

View File

@ -31,11 +31,22 @@
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VSimpleSplinePath constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id spline path id.
* @param factor scale factor.
*/
VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor) VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor)
:VAbstractTool(doc, data, id), factor(factor) :VAbstractTool(doc, data, id), factor(factor)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -46,6 +57,10 @@ void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -53,6 +68,10 @@ void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);

View File

@ -40,35 +40,14 @@ class VSimpleSplinePath : public VAbstractTool, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VSimpleSplinePath constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id spline path id.
* @param factor scale factor.
*/
VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor); VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor);
protected: protected:
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/**
* @brief hoverMoveEvent handle hover move events.
* @param event hover move event.
*/
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief hoverLeaveEvent handle hover leave events.
* @param event hover leave event.
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private: private:
Q_DISABLE_COPY(VSimpleSplinePath) Q_DISABLE_COPY(VSimpleSplinePath)
/** /** @brief factor scale factor. */
* @brief factor scale factor.
*/
qreal *factor; qreal *factor;
}; };

View File

@ -41,6 +41,9 @@ VTableGraphicsView::VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief selectionChanged handle selection change.
*/
void VTableGraphicsView::selectionChanged() void VTableGraphicsView::selectionChanged()
{ {
QList<QGraphicsItem *> listSelectedItems = scene()->selectedItems(); QList<QGraphicsItem *> listSelectedItems = scene()->selectedItems();
@ -57,6 +60,9 @@ void VTableGraphicsView::selectionChanged()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief MirrorItem mirror detail.
*/
void VTableGraphicsView::MirrorItem() void VTableGraphicsView::MirrorItem()
{ {
QList<QGraphicsItem *> list = scene()->selectedItems(); QList<QGraphicsItem *> list = scene()->selectedItems();
@ -98,6 +104,10 @@ void VTableGraphicsView::MirrorItem()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief wheelEvent handle wheel events.
* @param event wheel event.
*/
void VTableGraphicsView::wheelEvent(QWheelEvent *event) void VTableGraphicsView::wheelEvent(QWheelEvent *event)
{ {
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier) if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
@ -119,6 +129,10 @@ void VTableGraphicsView::wheelEvent(QWheelEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mousePressEvent handle mouse press events.
* @param mousePress mouse press event.
*/
void VTableGraphicsView::mousePressEvent(QMouseEvent *mousePress) void VTableGraphicsView::mousePressEvent(QMouseEvent *mousePress)
{ {
if (mousePress->button() & Qt::LeftButton) if (mousePress->button() & Qt::LeftButton)
@ -137,6 +151,10 @@ void VTableGraphicsView::mousePressEvent(QMouseEvent *mousePress)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void VTableGraphicsView::mouseReleaseEvent(QMouseEvent *event) void VTableGraphicsView::mouseReleaseEvent(QMouseEvent *event)
{ {
QGraphicsView::mouseReleaseEvent ( event ); QGraphicsView::mouseReleaseEvent ( event );
@ -144,6 +162,10 @@ void VTableGraphicsView::mouseReleaseEvent(QMouseEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief keyPressEvent handle key press events.
* @param event key press event.
*/
void VTableGraphicsView::keyPressEvent(QKeyEvent *event) void VTableGraphicsView::keyPressEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())
@ -170,6 +192,9 @@ void VTableGraphicsView::keyPressEvent(QKeyEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief rotateIt rotate selected details on 180 degree.
*/
void VTableGraphicsView::rotateIt() void VTableGraphicsView::rotateIt()
{ {
QList<QGraphicsItem *> list = scene()->selectedItems(); QList<QGraphicsItem *> list = scene()->selectedItems();
@ -186,6 +211,10 @@ void VTableGraphicsView::rotateIt()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief MoveItem move selected detail.
* @param move type of move.
*/
void VTableGraphicsView::MoveItem(VTableGraphicsView::typeMove_e move) void VTableGraphicsView::MoveItem(VTableGraphicsView::typeMove_e move)
{ {
qreal dx = 0, dy = 0; qreal dx = 0, dy = 0;

View File

@ -51,69 +51,42 @@ signals:
*/ */
void itemChect( bool flag ); void itemChect( bool flag );
public slots: public slots:
/**
* @brief selectionChanged handle selection change.
*/
void selectionChanged(); void selectionChanged();
void rotateItems();
void MirrorItem();
void ZoomIn();
void ZoomOut();
protected:
void wheelEvent ( QWheelEvent * event );
void mousePressEvent(QMouseEvent *mousePress);
void mouseReleaseEvent ( QMouseEvent * event );
void keyPressEvent ( QKeyEvent * event );
void rotateIt();
void MoveItem( VTableGraphicsView::typeMove_e move );
};
//---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief rotateItems handle rotatation detail. * @brief rotateItems handle rotatation detail.
*/ */
void rotateItems();
/**
* @brief MirrorItem mirror detail.
*/
void MirrorItem();
/**
* @brief ZoomIn zoom in paper scale.
*/
void ZoomIn();
/**
* @brief ZoomOut zoom out paper scale.
*/
void ZoomOut();
protected:
/**
* @brief wheelEvent handle wheel events.
* @param event wheel event.
*/
void wheelEvent ( QWheelEvent * event );
/**
* @brief mousePressEvent handle mouse press events.
* @param mousePress mouse press event.
*/
void mousePressEvent(QMouseEvent *mousePress);
/**
* @brief mouseReleaseEvent handle mouse release events.
* @param event mouse release event.
*/
void mouseReleaseEvent ( QMouseEvent * event );
/**
* @brief keyPressEvent handle key press events.
* @param event key press event.
*/
void keyPressEvent ( QKeyEvent * event );
/**
* @brief rotateIt rotate selected details on 180 degree.
*/
void rotateIt();
/**
* @brief MoveItem move selected detail.
* @param move type of move.
*/
void MoveItem( VTableGraphicsView::typeMove_e move );
};
inline void VTableGraphicsView::rotateItems() inline void VTableGraphicsView::rotateItems()
{ {
rotateIt(); rotateIt();
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ZoomIn zoom in paper scale.
*/
inline void VTableGraphicsView::ZoomIn() inline void VTableGraphicsView::ZoomIn()
{ {
scale(1.1, 1.1); scale(1.1, 1.1);
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ZoomOut zoom out paper scale.
*/
inline void VTableGraphicsView::ZoomOut() inline void VTableGraphicsView::ZoomOut()
{ {
scale(1/1.1, 1/1.1); scale(1/1.1, 1/1.1);

View File

@ -104,6 +104,11 @@ VDomDocument::~VDomDocument()
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Finds an element by id.
* @param id value id attribute.
* @return dom element.
*/
QDomElement VDomDocument::elementById(const QString& id) QDomElement VDomDocument::elementById(const QString& id)
{ {
if (map.contains(id)) if (map.contains(id))
@ -125,6 +130,10 @@ QDomElement VDomDocument::elementById(const QString& id)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Removes all children of a given element tag. RENAME: removeAllChildren
* @param element tag
*/
void VDomDocument::removeAllChilds(QDomElement &element) void VDomDocument::removeAllChilds(QDomElement &element)
{ {
QDomNode domNode = element.firstChild(); QDomNode domNode = element.firstChild();
@ -143,6 +152,12 @@ void VDomDocument::removeAllChilds(QDomElement &element)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Find element by id.
* @param node node
* @param id id value
* @return true if found
*/
bool VDomDocument::find(const QDomElement &node, const QString& id) bool VDomDocument::find(const QDomElement &node, const QString& id)
{ {
if (node.hasAttribute(AttrId)) if (node.hasAttribute(AttrId))
@ -170,6 +185,12 @@ bool VDomDocument::find(const QDomElement &node, const QString& id)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Returns the long long value of the given attribute. RENAME: GetParameterLongLong?
* @param domElement tag in xml tree
* @param name attribute name
* @return long long value
*/
quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue) const quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue) const
{ {
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
@ -200,6 +221,13 @@ quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QStri
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Returns the string value of the given attribute. RENAME: see above
*
* if attribute empty return default value. If default value empty too throw exception.
* @return attribute value
* @throw VExceptionEmptyParameter when attribute is empty
*/
QString VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name, QString VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name,
const QString &defValue) const const QString &defValue) const
{ {
@ -221,6 +249,12 @@ QString VDomDocument::GetParametrString(const QDomElement &domElement, const QSt
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief Returns the double value of the given attribute.
* @param domElement tag in xml tree
* @param name attribute name
* @return double value
*/
qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue) const qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue) const
{ {
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
@ -272,6 +306,11 @@ QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVa
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief ValidateXML validate xml file by xsd schema.
* @param schema path to schema file.
* @param fileName name of xml file.
*/
void VDomDocument::ValidateXML(const QString &schema, const QString &fileName) void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
{ {
QFile pattern(fileName); QFile pattern(fileName);

View File

@ -79,16 +79,7 @@ public:
*/ */
VDomDocument(VContainer *data); VDomDocument(VContainer *data);
virtual ~VDomDocument(); virtual ~VDomDocument();
/**
* @brief Finds an element by id.
* @param id value id attribute.
* @return dom element.
*/
QDomElement elementById(const QString& id); QDomElement elementById(const QString& id);
/**
* @brief Removes all children of a given element tag. RENAME: removeAllChildren
* @param element tag
*/
void removeAllChilds(QDomElement &element); void removeAllChilds(QDomElement &element);
template <typename T> template <typename T>
/** /**
@ -108,36 +99,11 @@ public:
val = val.replace(",", "."); val = val.replace(",", ".");
domElement.setAttribute(name, val); domElement.setAttribute(name, val);
} }
/** quint32 GetParametrUInt(const QDomElement& domElement, const QString &name, const QString &defValue) const;
* @brief Returns the long long value of the given attribute. RENAME: GetParameterLongLong?
* @param domElement tag in xml tree
* @param name attribute name
* @return long long value
*/
quint32 GetParametrUInt(const QDomElement& domElement, const QString &name,
const QString &defValue) const;
/**
* @brief Returns the string value of the given attribute. RENAME: see above
*
* if attribute empty return default value. If default value empty too throw exception.
* @return attribute value
* @throw VExceptionEmptyParameter when attribute is empty
*/
QString GetParametrString(const QDomElement& domElement, const QString &name, QString GetParametrString(const QDomElement& domElement, const QString &name,
const QString &defValue = QString()) const; const QString &defValue = QString()) const;
/**
* @brief Returns the double value of the given attribute.
* @param domElement tag in xml tree
* @param name attribute name
* @return double value
*/
qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue) const; qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue) const;
QString UniqueTagText(const QString &tagName, const QString &defVal = QString()) const; QString UniqueTagText(const QString &tagName, const QString &defVal = QString()) const;
/**
* @brief ValidateXML validate xml file by xsd schema.
* @param schema path to schema file.
* @param fileName name of xml file.
*/
static void ValidateXML(const QString &schema, const QString &fileName); static void ValidateXML(const QString &schema, const QString &fileName);
void setContent(const QString &fileName); void setContent(const QString &fileName);
static Unit StrToUnits(const QString &unit); static Unit StrToUnits(const QString &unit);
@ -148,27 +114,19 @@ public:
QString Patch() const; QString Patch() const;
static void RemoveAllChild(QDomElement &domElement); static void RemoveAllChild(QDomElement &domElement);
protected: protected:
/** /** @brief data container with data. */
* @brief data container with data.
*/
VContainer *data; VContainer *data;
void setTagText(const QString &tag, const QString &text); void setTagText(const QString &tag, const QString &text);
private: private:
Q_DISABLE_COPY(VDomDocument) Q_DISABLE_COPY(VDomDocument)
/** /** @brief Map used for finding element by id. */
* @brief Map used for finding element by id.
*/
QHash<QString, QDomElement> map; QHash<QString, QDomElement> map;
/**
* @brief Find element by id.
* @param node node
* @param id id value
* @return true if found
*/
bool find(const QDomElement &node, const QString& id); bool find(const QDomElement &node, const QString& id);
}; };
//---------------------------------------------------------------------------------------------------------------------
template <> template <>
inline void VDomDocument::SetAttribute<QString>(QDomElement &domElement, const QString &name, inline void VDomDocument::SetAttribute<QString>(QDomElement &domElement, const QString &name,
const QString &value) const const QString &value) const
@ -176,6 +134,7 @@ inline void VDomDocument::SetAttribute<QString>(QDomElement &domElement, const Q
domElement.setAttribute(name, value); domElement.setAttribute(name, value);
} }
//---------------------------------------------------------------------------------------------------------------------
template <> template <>
inline void VDomDocument::SetAttribute<MeasurementsType>(QDomElement &domElement, const QString &name, inline void VDomDocument::SetAttribute<MeasurementsType>(QDomElement &domElement, const QString &name,
const MeasurementsType &value) const const MeasurementsType &value) const

View File

@ -29,11 +29,20 @@
#include "vtoolrecord.h" #include "vtoolrecord.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolRecord default constructor.
*/
VToolRecord::VToolRecord() VToolRecord::VToolRecord()
:id(0), typeTool(Tool::ArrowTool), nameDraw(QString()) :id(0), typeTool(Tool::ArrowTool), nameDraw(QString())
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolRecord constructor.
* @param id tool id.
* @param typeTool tool type.
* @param nameDraw pattern peace name.
*/
VToolRecord::VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw) VToolRecord::VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw)
:id(id), typeTool(typeTool), nameDraw(nameDraw) :id(id), typeTool(typeTool), nameDraw(nameDraw)
{} {}

View File

@ -39,87 +39,80 @@
class VToolRecord class VToolRecord
{ {
public: public:
/**
* @brief VToolRecord default constructor.
*/
VToolRecord(); VToolRecord();
/**
* @brief VToolRecord constructor.
* @param id tool id.
* @param typeTool tool type.
* @param nameDraw pattern peace name.
*/
VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw); VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw);
quint32 getId() const;
void setId(const quint32 &value);
Tool getTypeTool() const;
void setTypeTool(const Tool &value);
QString getNameDraw() const;
void setNameDraw(const QString &value);
private:
/** @brief id tool id. */
quint32 id;
/** @brief typeTool tool type. */
Tool typeTool;
/** @brief nameDraw pattern peace name. */
QString nameDraw;
};
//---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief getId return tool id. * @brief getId return tool id.
* @return id. * @return id.
*/ */
quint32 getId() const;
/**
* @brief setId set tool id.
* @param value id.
*/
void setId(const quint32 &value);
/**
* @brief getTypeTool return tool type.
* @return tool type.
*/
Tool getTypeTool() const;
/**
* @brief setTypeTool set tool type.
* @param value tool type.
*/
void setTypeTool(const Tool &value);
/**
* @brief getNameDraw return pattern peace name.
* @return pattern peace name.
*/
QString getNameDraw() const;
/**
* @brief setNameDraw set pattern peace name.
* @param value pattern peace name.
*/
void setNameDraw(const QString &value);
private:
/**
* @brief id tool id.
*/
quint32 id;
/**
* @brief typeTool tool type.
*/
Tool typeTool;
/**
* @brief nameDraw pattern peace name.
*/
QString nameDraw;
};
inline quint32 VToolRecord::getId() const inline quint32 VToolRecord::getId() const
{ {
return id; return id;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setId set tool id.
* @param value id.
*/
inline void VToolRecord::setId(const quint32 &value) inline void VToolRecord::setId(const quint32 &value)
{ {
id = value; id = value;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getTypeTool return tool type.
* @return tool type.
*/
inline Tool VToolRecord::getTypeTool() const inline Tool VToolRecord::getTypeTool() const
{ {
return typeTool; return typeTool;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setTypeTool set tool type.
* @param value tool type.
*/
inline void VToolRecord::setTypeTool(const Tool &value) inline void VToolRecord::setTypeTool(const Tool &value)
{ {
typeTool = value; typeTool = value;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getNameDraw return pattern peace name.
* @return pattern peace name.
*/
inline QString VToolRecord::getNameDraw() const inline QString VToolRecord::getNameDraw() const
{ {
return nameDraw; return nameDraw;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setNameDraw set pattern peace name.
* @param value pattern peace name.
*/
inline void VToolRecord::setNameDraw(const QString &value) inline void VToolRecord::setNameDraw(const QString &value)
{ {
nameDraw = value; nameDraw = value;