[TD]implement BrokenView

This commit is contained in:
wandererfan
2024-03-14 21:04:23 -04:00
committed by WandererFan
parent efa3a7e6ef
commit 43fc04309a
31 changed files with 2749 additions and 32 deletions

View File

@@ -74,6 +74,7 @@
#include "GeometryMatcher.h"
#include "Preferences.h"
#include "DimensionAutoCorrect.h"
#include "DrawBrokenView.h"
using namespace TechDraw;
using namespace Part;
@@ -648,7 +649,21 @@ double DrawViewDimension::getDimValue()
return result;
}
if (Type.isValue("Distance") || Type.isValue("DistanceX") || Type.isValue("DistanceY")) {
// linear points are inverted? +Y down? scaled!
pointPair pts = getLinearPoints();
auto dbv = dynamic_cast<DrawBrokenView*>(getViewPart());
if (dbv) {
// pts are inverted Y, so we need to un-invert them before mapping
// pts are scaled, so we need to unscale them for mapPoint2dFromView
// then rescale them for the distance calculation below
// centers are right side up
pts.invertY();
pts.scale(1.0 / getViewPart()->getScale());
pts.first(dbv->mapPoint2dFromView(pts.first()));
pts.second(dbv->mapPoint2dFromView(pts.second()));
pts.invertY();
pts.scale(getViewPart()->getScale());
}
Base::Vector3d dimVec = pts.first() - pts.second();
if (Type.isValue("Distance")) {
result = dimVec.Length() / getViewPart()->getScale();