From d8d6ed53848e4244d0e8ca483180ee212c352e12 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Thu, 18 Aug 2011 01:37:39 +0300 Subject: [PATCH] Changed: #1302 The value angle can save in file. --- .../src/plugins/world_editor/world_editor_actions.cpp | 5 ++++- .../src/plugins/world_editor/world_editor_plugin.cpp | 2 +- .../src/plugins/world_editor/world_editor_scene_item.cpp | 9 +++++++-- .../src/plugins/world_editor/world_editor_scene_item.h | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp index b0a201980..b22e3fe64 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp @@ -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(item)->angle(); + angle = 2 * NLMISC::Pi - (angle * NLMISC::Pi / 180.0); NLLIGO::CPrimPoint *point = static_cast(primitive); point->Point = vPoints.front(); + point->Angle = angle; break; } case NLLIGO::CPrimitiveClass::Path: diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp index 8699bfb67..23b51e9e3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp @@ -110,7 +110,7 @@ QString WorldEditorPlugin::name() const QString WorldEditorPlugin::version() const { - return "0.0.1"; + return "0.1"; } QString WorldEditorPlugin::vendor() const diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.cpp index 28c933d39..b4d01be65 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.cpp @@ -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()); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.h index b42138833..7268b6d03 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.h @@ -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);