2013-12-29 17:48:57 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vgobject.cpp
|
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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vgobject.h"
|
2014-08-20 14:01:35 +02:00
|
|
|
#include "vgobject_p.h"
|
2013-12-29 17:48:57 +01:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief VGObject default constructor.
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
VGObject::VGObject()
|
2014-08-20 14:01:35 +02:00
|
|
|
:d(new VGObjectData)
|
2014-05-02 13:11:30 +02:00
|
|
|
{}
|
2013-12-29 17:48:57 +01:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief VGObject constructor.
|
|
|
|
* @param type type graphical object.
|
|
|
|
* @param idObject id parent object.
|
|
|
|
* @param mode mode creation. Used in modeling mode.
|
|
|
|
*/
|
2014-06-12 09:22:29 +02:00
|
|
|
VGObject::VGObject(const GOType &type, const quint32 &idObject, const Draw &mode)
|
2014-08-20 14:01:35 +02:00
|
|
|
:d(new VGObjectData(type, idObject, mode))
|
2014-05-02 13:11:30 +02:00
|
|
|
{}
|
2013-12-29 17:48:57 +01:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief VGObject copy constructor.
|
|
|
|
* @param obj object.
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
VGObject::VGObject(const VGObject &obj)
|
2014-08-20 14:01:35 +02:00
|
|
|
:d (obj.d)
|
2014-05-02 13:11:30 +02:00
|
|
|
{}
|
2013-12-29 17:48:57 +01:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief operator = assignment operator.
|
|
|
|
* @param obj object
|
|
|
|
* @return object
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
VGObject &VGObject::operator=(const VGObject &obj)
|
|
|
|
{
|
2014-07-27 14:30:28 +02:00
|
|
|
if ( &obj == this )
|
|
|
|
{
|
|
|
|
return *this;
|
|
|
|
}
|
2014-08-20 14:01:35 +02:00
|
|
|
d = obj.d;
|
2013-12-29 17:48:57 +01:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2014-08-20 14:01:35 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VGObject::~VGObject()
|
|
|
|
{}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02: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 VGObject::getIdObject() const
|
2013-12-29 17:48:57 +01:00
|
|
|
{
|
2014-08-20 14:01:35 +02:00
|
|
|
return d->idObject;
|
2013-12-29 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief setIdObject set parent id.
|
|
|
|
* @param value parent id.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
void VGObject::setIdObject(const quint32 &value)
|
2013-12-29 17:48:57 +01:00
|
|
|
{
|
2014-08-20 14:01:35 +02:00
|
|
|
d->idObject = value;
|
2013-12-29 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief name return name graphical object.
|
|
|
|
* @return name
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
QString VGObject::name() const
|
|
|
|
{
|
2014-08-20 14:01:35 +02:00
|
|
|
return d->_name;
|
2013-12-29 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief setName set name graphical object.
|
|
|
|
* @param name name graphical object.
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
void VGObject::setName(const QString &name)
|
|
|
|
{
|
2014-08-20 14:01:35 +02:00
|
|
|
d->_name = name;
|
2013-12-29 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2014-06-01 09:35:13 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief getMode return mode creation.
|
|
|
|
* @return mode.
|
|
|
|
*/
|
2014-06-12 09:22:29 +02:00
|
|
|
Draw VGObject::getMode() const
|
2013-12-29 17:48:57 +01:00
|
|
|
{
|
2014-08-20 14:01:35 +02:00
|
|
|
return d->mode;
|
2013-12-29 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief setMode set mode creation.
|
|
|
|
* @param value mode.
|
|
|
|
*/
|
2014-06-12 09:22:29 +02:00
|
|
|
void VGObject::setMode(const Draw &value)
|
2013-12-29 17:48:57 +01:00
|
|
|
{
|
2014-08-20 14:01:35 +02:00
|
|
|
d->mode = value;
|
2013-12-29 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief getType return object type.
|
|
|
|
* @return type.
|
|
|
|
*/
|
2014-06-12 09:22:29 +02:00
|
|
|
GOType VGObject::getType() const
|
2013-12-29 17:48:57 +01:00
|
|
|
{
|
2014-08-20 14:01:35 +02:00
|
|
|
return d->type;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGObject::setType(const GOType &type)
|
|
|
|
{
|
|
|
|
d->type = type;
|
2013-12-29 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief id return id object.
|
|
|
|
* @return id
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
quint32 VGObject::id() const
|
2013-12-29 17:48:57 +01:00
|
|
|
{
|
2014-08-20 14:01:35 +02:00
|
|
|
return d->_id;
|
2013-12-29 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-01 09:35:13 +02:00
|
|
|
/**
|
|
|
|
* @brief setId set id object.
|
|
|
|
* @param id id.
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
void VGObject::setId(const quint32 &id)
|
2013-12-29 17:48:57 +01:00
|
|
|
{
|
2014-08-20 14:01:35 +02:00
|
|
|
d->_id = id;
|
2013-12-29 17:48:57 +01:00
|
|
|
}
|