[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:
WandererFan
2024-05-23 09:41:42 -04:00
committed by GitHub
parent a8d093280e
commit 50f970efd7
56 changed files with 1812 additions and 1076 deletions

View File

@@ -22,7 +22,6 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <cmath>
#endif // #ifndef _PreComp_
#include <Base/Console.h>
@@ -165,21 +164,22 @@ void TaskLineDecor::initializeRejectArrays()
}
}
// get the current line tool appearance default
void TaskLineDecor::getDefaults()
{
// Base::Console().Message("TLD::getDefaults()\n");
m_color = LineFormat::getDefEdgeColor();
m_weight = LineFormat::getDefEdgeWidth();
m_visible = true;
m_lineNumber = 1;
m_color = LineFormat::getCurrentLineFormat().getColor();
m_weight = LineFormat::getCurrentLineFormat().getWidth();
m_visible = LineFormat::getCurrentLineFormat().getVisible();
m_lineNumber = LineFormat::getCurrentLineFormat().getLineNumber();
//set defaults to format of 1st edge
if (!m_originalFormats.empty()) {
LineFormat &lf = m_originalFormats.front();
m_style = lf.m_style;
m_color = lf.m_color;
m_weight = lf.m_weight;
m_visible = lf.m_visible;
m_style = lf.getStyle();
m_color = lf.getColor();
m_weight = lf.getWidth();
m_visible = lf.getVisible();
m_lineNumber = lf.getLineNumber();
}
}
@@ -218,10 +218,10 @@ void TaskLineDecor::applyDecorations()
for (auto& e: m_edges) {
LineFormat *lf = getFormatAccessPtr(e);
if (lf) {
lf->m_style = m_style;
lf->m_color = m_color;
lf->m_weight = m_weight;
lf->m_visible = m_visible;
lf->setStyle(m_style);
lf->setColor(m_color);
lf->setWidth(m_weight);
lf->setVisible(m_visible);
lf->setLineNumber(m_lineNumber);
}
}
@@ -353,7 +353,7 @@ int TaskRestoreLines::countInvisibleGeoms()
int iGeoms = 0;
const std::vector<TechDraw::GeomFormat*> geoms = m_partFeat->GeomFormats.getValues();
for (auto& g : geoms) {
if (!g->m_format.m_visible) {
if (!g->m_format.getVisible()) {
iGeoms++;
}
}
@@ -365,7 +365,7 @@ int TaskRestoreLines::countInvisibleCosmetics()
int iCosmos = 0;
const std::vector<TechDraw::CosmeticEdge*> cosmos = m_partFeat->CosmeticEdges.getValues();
for (auto& c : cosmos) {
if (!c->m_format.m_visible) {
if (!c->m_format.getVisible()) {
iCosmos++;
}
}
@@ -377,7 +377,7 @@ int TaskRestoreLines::countInvisibleCenters()
int iCenter = 0;
const std::vector<TechDraw::CenterLine*> centers = m_partFeat->CenterLines.getValues();
for (auto& c : centers) {
if (!c->m_format.m_visible) {
if (!c->m_format.getVisible()) {
iCenter++;
}
}
@@ -395,8 +395,8 @@ void TaskRestoreLines::restoreInvisibleGeoms()
{
const std::vector<TechDraw::GeomFormat*> geoms = m_partFeat->GeomFormats.getValues();
for (auto& g : geoms) {
if (!g->m_format.m_visible) {
g->m_format.m_visible = true;
if (!g->m_format.getVisible()) {
g->m_format.setVisible(true);
}
}
m_partFeat->GeomFormats.setValues(geoms);
@@ -407,8 +407,8 @@ void TaskRestoreLines::restoreInvisibleCosmetics()
{
const std::vector<TechDraw::CosmeticEdge*> cosmos = m_partFeat->CosmeticEdges.getValues();
for (auto& c : cosmos) {
if (!c->m_format.m_visible) {
c->m_format.m_visible = true;
if (!c->m_format.getVisible()) {
c->m_format.setVisible(true);
}
}
m_partFeat->CosmeticEdges.setValues(cosmos);
@@ -419,8 +419,8 @@ void TaskRestoreLines::restoreInvisibleCenters()
{
const std::vector<TechDraw::CenterLine*> centers = m_partFeat->CenterLines.getValues();
for (auto& c : centers) {
if (!c->m_format.m_visible) {
c->m_format.m_visible = true;
if (!c->m_format.getVisible()) {
c->m_format.setVisible(true);
}
}
m_partFeat->CenterLines.setValues(centers);