2013-12-29 17:48:57 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vgobject.h
|
|
|
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
|
|
** @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"
|
|
|
|
#include "../exception/vexception.h"
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QHash>
|
|
|
|
|
|
|
|
|
|
|
|
namespace GObject
|
|
|
|
{
|
|
|
|
/**
|
2014-01-21 15:04:17 +01:00
|
|
|
* @brief The NodeDetail enum type of graphical objects.
|
2013-12-29 17:48:57 +01:00
|
|
|
*/
|
|
|
|
enum Type { Point, Arc, Spline, SplinePath };
|
|
|
|
Q_DECLARE_FLAGS(Types, Type)
|
|
|
|
}
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(GObject::Types)
|
|
|
|
|
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:
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief VGObject default constructor.
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
VGObject();
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief VGObject constructor.
|
|
|
|
* @param type type graphical object.
|
|
|
|
* @param idObject id parent object.
|
|
|
|
* @param mode mode creation. Used in modeling mode.
|
|
|
|
*/
|
2014-03-11 12:43:24 +01:00
|
|
|
VGObject(const GObject::Type &type, const quint32 &idObject = 0,
|
|
|
|
const Valentina::Draws &mode = Valentina::Calculation);
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief VGObject copy constructor.
|
|
|
|
* @param obj object.
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
VGObject(const VGObject &obj);
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief operator = assignment operator.
|
|
|
|
* @param obj object
|
|
|
|
* @return object
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
VGObject& operator= (const VGObject &obj);
|
|
|
|
virtual ~VGObject(){}
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief getIdObject return parent id.
|
|
|
|
* @return parent id or 0 if object don't have parent.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
quint32 getIdObject() const;
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief setIdObject set parent id.
|
|
|
|
* @param value parent id.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
void setIdObject(const quint32 &value);
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief name return name graphical object.
|
|
|
|
* @return name
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
virtual QString name() const;
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief setName set name graphical object.
|
|
|
|
* @param name name graphical object.
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
void setName(const QString &name);
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief getMode return mode creation.
|
|
|
|
* @return mode.
|
|
|
|
*/
|
2014-03-11 12:43:24 +01:00
|
|
|
Valentina::Draws getMode() const;
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief setMode set mode creation.
|
|
|
|
* @param value mode.
|
|
|
|
*/
|
2014-03-11 12:43:24 +01:00
|
|
|
void setMode(const Valentina::Draws &value);
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief getType return object type.
|
|
|
|
* @return type.
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
GObject::Type getType() const;
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief id return id object.
|
|
|
|
* @return id
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
quint32 id() const;
|
2014-01-21 15:04:17 +01:00
|
|
|
/**
|
|
|
|
* @brief setId set id object.
|
|
|
|
* @param id id.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
virtual void setId(const quint32 &id);
|
2013-12-29 17:48:57 +01:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* @brief _id id in container. Ned for arcs, spline and spline paths.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
quint32 _id;
|
2013-12-29 17:48:57 +01:00
|
|
|
/**
|
|
|
|
* @brief type type of graphical object
|
|
|
|
*/
|
|
|
|
GObject::Type type;
|
|
|
|
/**
|
|
|
|
* @brief idObject id of parent object. Only for modeling. All another return 0.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
quint32 idObject;
|
2013-12-29 17:48:57 +01:00
|
|
|
/**
|
|
|
|
* @brief _name object name
|
|
|
|
*/
|
|
|
|
QString _name;
|
|
|
|
/**
|
|
|
|
* @brief mode object created in calculation or drawing mode
|
|
|
|
*/
|
2014-03-11 12:43:24 +01:00
|
|
|
Valentina::Draws mode;
|
2013-12-29 17:48:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VGOBJECT_H
|