2013-09-18 21:16:19 +02:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
|
|
|
** Copyright (C) 2013 Valentina project All Rights Reserved.
|
|
|
|
**
|
|
|
|
** This file is part of Valentina.
|
|
|
|
**
|
|
|
|
** Tox is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Tox is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-07-25 20:39:51 +02:00
|
|
|
#ifndef VABSTRACTTOOL_H
|
|
|
|
#define VABSTRACTTOOL_H
|
|
|
|
|
2013-09-18 21:16:19 +02:00
|
|
|
#include "xml/vdomdocument.h"
|
2013-08-13 18:48:36 +02:00
|
|
|
#include "vdatatool.h"
|
2013-07-25 20:39:51 +02:00
|
|
|
|
2013-09-29 13:53:42 +02:00
|
|
|
class VAbstractTool: public VDataTool{
|
2013-07-25 20:39:51 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-09-10 14:29:06 +02:00
|
|
|
VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0);
|
|
|
|
virtual ~VAbstractTool();
|
|
|
|
static QPointF LineIntersectRect(QRectF rec, QLineF line);
|
|
|
|
static qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1,
|
|
|
|
QPointF &p2);
|
|
|
|
static QPointF ClosestPoint(QLineF line, QPointF p);
|
|
|
|
static QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k);
|
2013-10-18 12:03:01 +02:00
|
|
|
qint64 getId() const;
|
|
|
|
static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c);
|
2013-07-25 20:39:51 +02:00
|
|
|
public slots:
|
2013-09-10 14:29:06 +02:00
|
|
|
virtual void FullUpdateFromFile()=0;
|
2013-07-25 20:39:51 +02:00
|
|
|
signals:
|
2013-09-10 14:29:06 +02:00
|
|
|
void toolhaveChange();
|
2013-09-27 11:17:00 +02:00
|
|
|
void ChoosedTool(qint64 id, Scene::Scenes type);
|
2013-09-10 14:29:06 +02:00
|
|
|
void FullUpdateTree();
|
2013-07-25 20:39:51 +02:00
|
|
|
protected:
|
2013-09-10 14:29:06 +02:00
|
|
|
VDomDocument *doc;
|
2013-09-30 18:29:03 +02:00
|
|
|
const qint64 id;
|
2013-08-15 22:39:00 +02:00
|
|
|
const Qt::GlobalColor baseColor;
|
2013-09-10 14:29:06 +02:00
|
|
|
Qt::GlobalColor currentColor;
|
|
|
|
virtual void AddToFile()=0;
|
|
|
|
void AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value);
|
|
|
|
void AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value);
|
|
|
|
void AddAttribute(QDomElement &domElement, const QString &name, const qreal &value);
|
|
|
|
void AddAttribute(QDomElement &domElement, const QString &name, const QString &value);
|
|
|
|
const VContainer *getData() const;
|
2013-09-30 18:29:03 +02:00
|
|
|
virtual void RemoveReferens(){}
|
2013-10-25 13:16:07 +02:00
|
|
|
void RemoveAllChild(QDomElement &domElement);
|
2013-08-20 12:26:02 +02:00
|
|
|
private:
|
2013-09-26 20:50:52 +02:00
|
|
|
Q_DISABLE_COPY(VAbstractTool)
|
2013-07-25 20:39:51 +02:00
|
|
|
};
|
|
|
|
#endif // VABSTRACTTOOL_H
|