2013-12-29 17:48:57 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vgobject.h
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-12-29 17:48:57 +01:00
|
|
|
** @date 27 12, 2013
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2013 Valentina project
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina 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.
|
|
|
|
**
|
|
|
|
** Valentina 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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VGOBJECT_H
|
|
|
|
#define VGOBJECT_H
|
|
|
|
|
|
|
|
#include "../options.h"
|
2014-06-17 11:50:11 +02:00
|
|
|
#include <QString>
|
|
|
|
#include <QtGlobal>
|
2014-08-20 14:01:35 +02:00
|
|
|
#include <QSharedDataPointer>
|
2013-12-29 17:48:57 +01:00
|
|
|
|
2014-08-20 14:01:35 +02:00
|
|
|
class VGObjectData;
|
2014-10-23 10:38:57 +02:00
|
|
|
class QLineF;
|
|
|
|
class QPointF;
|
|
|
|
class QRectF;
|
2013-12-29 17:48:57 +01:00
|
|
|
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief The VGObject class keep information graphical objects.
|
|
|
|
*/
|
2013-12-30 20:33:30 +01:00
|
|
|
class VGObject
|
2013-12-29 17:48:57 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
VGObject();
|
2014-06-12 09:22:29 +02:00
|
|
|
VGObject(const GOType &type, const quint32 &idObject = 0, const Draw &mode = Draw::Calculation);
|
2013-12-29 17:48:57 +01:00
|
|
|
VGObject(const VGObject &obj);
|
|
|
|
VGObject& operator= (const VGObject &obj);
|
2014-08-20 14:01:35 +02:00
|
|
|
virtual ~VGObject();
|
|
|
|
|
2014-07-25 13:53:39 +02:00
|
|
|
quint32 getIdObject() const;
|
|
|
|
void setIdObject(const quint32 &value);
|
2014-08-20 14:01:35 +02:00
|
|
|
|
2014-07-25 13:53:39 +02:00
|
|
|
virtual QString name() const;
|
|
|
|
void setName(const QString &name);
|
2014-08-20 14:01:35 +02:00
|
|
|
|
2014-07-25 13:53:39 +02:00
|
|
|
Draw getMode() const;
|
|
|
|
void setMode(const Draw &value);
|
2014-08-20 14:01:35 +02:00
|
|
|
|
2014-07-25 13:53:39 +02:00
|
|
|
GOType getType() const;
|
2014-08-20 14:01:35 +02:00
|
|
|
void setType(const GOType &type);
|
|
|
|
|
2014-07-25 13:53:39 +02:00
|
|
|
quint32 id() const;
|
|
|
|
virtual void setId(const quint32 &id);
|
2014-10-23 10:38:57 +02:00
|
|
|
|
|
|
|
static QLineF BuildLine(const QPointF &p1, const qreal& length, const qreal &angle);
|
|
|
|
static QPointF BuildRay(const QPointF &firstPoint, const qreal &angle, const QRectF &scRect);
|
|
|
|
static QLineF BuildAxis(const QPointF &p, const qreal &angle, const QRectF &scRect);
|
|
|
|
static QLineF BuildAxis(const QPointF &p1, const QPointF &p2, const QRectF &scRect);
|
|
|
|
|
2014-11-11 09:16:37 +01:00
|
|
|
static QPointF LineIntersectRect(const QRectF &rec, const QLineF &line);
|
2014-10-23 10:38:57 +02:00
|
|
|
static qint32 LineIntersectCircle(const QPointF ¢er, qreal radius, const QLineF &line, QPointF &p1,
|
|
|
|
QPointF &p2);
|
|
|
|
static QPointF ClosestPoint(const QLineF &line, const QPointF &point);
|
|
|
|
static QPointF addVector (const QPointF &p, const QPointF &p1, const QPointF &p2, qreal k);
|
|
|
|
static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c);
|
2014-08-20 14:01:35 +02:00
|
|
|
private:
|
|
|
|
QSharedDataPointer<VGObjectData> d;
|
2013-12-29 17:48:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VGOBJECT_H
|