[TD]Cosmetic function overhaul (#14216)
* [TD]Cosmetic geometry and tools update - all cosmetics to store geometry in same form - all cosmetics to survive scaling and rotation - extension functions to survive scaling and rotation * [TD]overhaul leader point storage and editing - add py routine makeLeader(points) * [TD]add leader conversion utility * [TD]Set Leader RotateWithView default to true * [TD]fix intersection vertex position * [TD]add CosmeticEdge::makeLineFromCanonicalPoints * [TD]fix 2 Extension tools - positioning in DrawCosmeticCircle - mishandling of points in execLineParallelPerpendicular * [TD]Remove duplicate constexpr * [TD]fix 2x Cosmetic arc tools * [TD]refactor LineFormat out of Cosmetic * [TD]move cosmetic appearance settings to LineFormat * [TD]remove 2 unused methods * [TD]apply format to blue line & circle tools * [TD]fix ballon arrowhead does not rotate with view * [TD]fix CosmeticCircle3Points * [TD]allow multiple cosmetic object deletions * [TD]fix extend/shorten centerline
This commit is contained in:
@@ -69,9 +69,11 @@
|
||||
#include "MDIViewPage.h"
|
||||
#include "QGSPage.h"
|
||||
#include "ViewProviderPage.h"
|
||||
#include "Rez.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
using DU = DrawUtil;
|
||||
|
||||
void DrawGuiUtil::loadArrowBox(QComboBox* qcb)
|
||||
{
|
||||
@@ -569,3 +571,44 @@ void DrawGuiUtil::setSelectedTree(QGraphicsItem *item, bool selected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! convert point from scene coords to mm and conventional Y axis (page coords).
|
||||
Base::Vector3d DrawGuiUtil::fromSceneCoords(const Base::Vector3d& sceneCoord, bool invert)
|
||||
{
|
||||
Base::Vector3d result;
|
||||
if (invert) {
|
||||
result = Rez::appX(DU::invertY(sceneCoord));
|
||||
} else {
|
||||
result = Rez::appX(sceneCoord);
|
||||
}
|
||||
return Rez::appX(DU::invertY(sceneCoord));
|
||||
}
|
||||
|
||||
//! convert point from printed page coords to scene units (Rez(mm) and inverted Y axis (scene coords)
|
||||
Base::Vector3d DrawGuiUtil::toSceneCoords(const Base::Vector3d& pageCoord, bool invert)
|
||||
{
|
||||
Base::Vector3d result;
|
||||
if (invert) {
|
||||
result = Rez::guiX(DU::invertY(pageCoord));
|
||||
} else {
|
||||
result = Rez::guiX(pageCoord);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//! convert unscaled, unrotated point to scaled, rotated view coordinates
|
||||
Base::Vector3d DrawGuiUtil::toGuiPoint(DrawView* obj, const Base::Vector3d& toConvert)
|
||||
{
|
||||
Base::Vector3d result{toConvert};
|
||||
auto rotDegrees = obj->Rotation.getValue();
|
||||
if (rotDegrees != 0.0) {
|
||||
result.RotateZ(Base::toRadians(rotDegrees));
|
||||
}
|
||||
result *= obj->getScale();
|
||||
result = DU::invertY(result);
|
||||
result = Rez::guiX(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user