[TechDraw] Add ability to align points by rotating view

Fixes #7061
This commit is contained in:
Benjamin Bræstrup Sayoc
2024-09-14 00:20:53 +02:00
committed by WandererFan
parent 516595fbce
commit 4d9e4efc87
12 changed files with 340 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (c) 2013 Luke Parry <l.parry@warwick.ac.uk> *
* Copyright (c) 2024 Benjamin Bræstrup Sayoc <benj5378@outlook.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -29,6 +30,8 @@
# include <QStyleOptionGraphicsItem>
#endif
#include <Base/Tools2D.h>
#include "QGIVertex.h"
#include "PreferencesGui.h"
#include "QGIPrimPath.h"
@@ -67,3 +70,16 @@ void QGIVertex::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
// setBrush(m_brush);
QGIPrimPath::paint (painter, &myOption, widget);
}
Base::Vector2d QGIVertex::toVector2d() const
{
QPointF center = boundingRect().center();
center = mapToScene(center);
return Base::Vector2d(center.x(), center.y());
}
//! Returns a vector drawn from own position to p2
Base::Vector2d QGIVertex::vector2dBetweenPoints(const QGIVertex* p2) const
{
return p2->toVector2d() - toVector2d();
}