valentina/tools/vabstracttool.h

51 lines
1.9 KiB
C
Raw Normal View History

2013-07-25 20:39:51 +02:00
#ifndef VABSTRACTTOOL_H
#define VABSTRACTTOOL_H
#include "../xml/vdomdocument.h"
#include "vdatatool.h"
#include "../container/vcontainer.h"
2013-07-25 20:39:51 +02:00
namespace Tool{
enum Enum
{
FromGui,
FromFile
};
}
class VAbstractTool:public VDataTool
2013-07-25 20:39:51 +02:00
{
Q_OBJECT
public:
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);
qint64 getId() const;
2013-07-25 20:39:51 +02:00
public slots:
virtual void FullUpdateFromFile()=0;
2013-07-25 20:39:51 +02:00
signals:
void toolhaveChange();
void ChoosedTool(qint64 id, Scene::Type type);
void FullUpdateTree();
2013-07-25 20:39:51 +02:00
protected:
VDomDocument *doc;
qint64 id;
2013-08-15 22:39:00 +02:00
const Qt::GlobalColor baseColor;
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-08-20 12:26:02 +02:00
private:
VAbstractTool(const VAbstractTool &tool);
const VAbstractTool &operator=(const VAbstractTool &tool);
2013-07-25 20:39:51 +02:00
};
#endif // VABSTRACTTOOL_H