Changed: #1302 The value angle can save in file.

--HG--
branch : gsoc2011-worldeditorqt
This commit is contained in:
dnk-88 2011-08-18 01:37:39 +03:00
parent adbcdcd9f0
commit eb3c9d2b90
4 changed files with 14 additions and 4 deletions

View file

@ -93,7 +93,7 @@ void addNewGraphicsItems(const QModelIndex &primIndex, PrimitivesTreeModel *mode
qreal radius = 0;
if (primitive->getPropertyByName ("radius", strRadius))
radius = atof(strRadius.c_str());
qreal angle = ((2 * NLMISC::Pi - primPoint->Angle) * 180 / NLMISC::Pi);
item = scene->addWorldItemPoint(QPointF(vec->x, -vec->y + cellSize),
primPoint->Angle, radius, showArrow);
break;
@ -511,8 +511,11 @@ void AbstractWorldItemCommand::updatePrimitiveData(AbstractWorldItem *item)
{
case NLLIGO::CPrimitiveClass::Point:
{
qreal angle = static_cast<WorldItemPoint *>(item)->angle();
angle = 2 * NLMISC::Pi - (angle * NLMISC::Pi / 180.0);
NLLIGO::CPrimPoint *point = static_cast<NLLIGO::CPrimPoint *>(primitive);
point->Point = vPoints.front();
point->Angle = angle;
break;
}
case NLLIGO::CPrimitiveClass::Path:

View file

@ -110,7 +110,7 @@ QString WorldEditorPlugin::name() const
QString WorldEditorPlugin::version() const
{
return "0.0.1";
return "0.1";
}
QString WorldEditorPlugin::vendor() const

View file

@ -91,7 +91,7 @@ bool AbstractWorldItem::isShapeChanged() const
WorldItemPoint::WorldItemPoint(const QPointF &point, const qreal angle, const qreal radius,
bool showArrow, QGraphicsItem *parent)
: AbstractWorldItem(parent),
m_angle((2 * NLMISC::Pi - angle) * 180 / NLMISC::Pi),
m_angle(angle),
m_radius(radius),
m_showArrow(showArrow)
{
@ -132,6 +132,11 @@ WorldItemPoint::~WorldItemPoint()
{
}
qreal WorldItemPoint::angle() const
{
return m_angle;
}
void WorldItemPoint::rotateOn(const QPointF &pivot, const qreal deltaAngle)
{
prepareGeometryChange();
@ -167,6 +172,7 @@ void WorldItemPoint::scaleOn(const QPointF &pivot, const QPointF &factor)
void WorldItemPoint::turnOn(const qreal angle)
{
m_angle += angle;
m_angle -= floor(m_angle / 360) * 360;
update();
}
@ -873,7 +879,6 @@ void WorldItemSubPoint::scaleOn(const QPointF &pivot, const QPointF &factor)
// TODO
scaledPolygon.translate(scenePos() - pivot);
//scaledPolygon.translate(-pivot);
QTransform trans;
trans = trans.scale(factor.x(), factor.y());

View file

@ -113,6 +113,8 @@ public:
bool showArrow, QGraphicsItem *parent = 0);
virtual ~WorldItemPoint();
qreal angle() const;
virtual void rotateOn(const QPointF &pivot, const qreal deltaAngle);
virtual void scaleOn(const QPointF &pivot, const QPointF &factor);
virtual void turnOn(const qreal angle);