[TD]fix fail on undo of cosmetic delete

This commit is contained in:
wandererfan
2024-03-25 21:51:47 -04:00
committed by WandererFan
parent 394ed4a38f
commit f530f1a5c8
11 changed files with 107 additions and 17 deletions

View File

@@ -349,7 +349,7 @@ TechDraw::CosmeticEdge* CosmeticExtension::getCosmeticEdge(const std::string& ta
/// used when selecting
TechDraw::CosmeticEdge* CosmeticExtension::getCosmeticEdgeBySelection(const std::string& name) const
{
// Base::Console().Message("CEx::getCEBySelection(%s)\n", name.c_str());
// Base::Console().Message("CEx::getCEBySelection(%s)\n", name.c_str());
App::DocumentObject* extObj = const_cast<App::DocumentObject*> (getExtendedObject());
TechDraw::DrawViewPart* dvp = dynamic_cast<TechDraw::DrawViewPart*>(extObj);
if (!dvp) {
@@ -367,7 +367,7 @@ TechDraw::CosmeticEdge* CosmeticExtension::getCosmeticEdgeBySelection(const std:
/// find the cosmetic edge corresponding to the input parameter (the 5 in Edge5)
TechDraw::CosmeticEdge* CosmeticExtension::getCosmeticEdgeBySelection(int i) const
{
// Base::Console().Message("CEx::getCEBySelection(%d)\n", i);
// Base::Console().Message("CEx::getCEBySelection(%d)\n", i);
std::stringstream edgeName;
edgeName << "Edge" << i;
return getCosmeticEdgeBySelection(edgeName.str());
@@ -376,7 +376,7 @@ TechDraw::CosmeticEdge* CosmeticExtension::getCosmeticEdgeBySelection(int i) con
/// remove the cosmetic edge with the given tag from the list property
void CosmeticExtension::removeCosmeticEdge(const std::string& delTag)
{
// Base::Console().Message("DVP::removeCE(%s)\n", delTag.c_str());
// Base::Console().Message("DVP::removeCE(%s)\n", delTag.c_str());
std::vector<CosmeticEdge*> cEdges = CosmeticEdges.getValues();
std::vector<CosmeticEdge*> newEdges;
for (auto& ce: cEdges) {
@@ -420,7 +420,6 @@ int CosmeticExtension::add1CLToGE(const std::string& tag)
return -1;
}
TechDraw::BaseGeomPtr scaledGeom = cl->scaledAndRotatedGeometry(getOwner());
// TechDraw::BaseGeomPtr scaledGeom = cl->scaledGeometry(getOwner());
int iGE = getOwner()->getGeometryObject()->addCenterLine(scaledGeom, tag);
return iGE;
@@ -429,7 +428,7 @@ int CosmeticExtension::add1CLToGE(const std::string& tag)
//update Edge geometry with current CL's
void CosmeticExtension::refreshCLGeoms()
{
// Base::Console().Message("CE::refreshCLGeoms()\n");
// Base::Console().Message("CE::refreshCLGeoms()\n");
std::vector<TechDraw::BaseGeomPtr> gEdges = getOwner()->getEdgeGeometry();
std::vector<TechDraw::BaseGeomPtr> newGEdges;
for (auto& ge : gEdges) {
@@ -447,7 +446,6 @@ void CosmeticExtension::addCenterLinesToGeom()
// Base::Console().Message("CE::addCenterLinesToGeom()\n");
const std::vector<TechDraw::CenterLine*> lines = CenterLines.getValues();
for (auto& cl : lines) {
// TechDraw::BaseGeomPtr scaledGeom = cl->scaledGeometry(getOwner());
TechDraw::BaseGeomPtr scaledGeom = cl->scaledAndRotatedGeometry(getOwner());
if (!scaledGeom) {
Base::Console().Error("CE::addCenterLinesToGeom - scaledGeometry is null\n");
@@ -536,7 +534,7 @@ TechDraw::CenterLine* CosmeticExtension::getCenterLineBySelection(int i) const
void CosmeticExtension::removeCenterLine(const std::string& delTag)
{
// Base::Console().Message("DVP::removeCL(%s)\n", delTag.c_str());
// Base::Console().Message("DVP::removeCL(%s)\n", delTag.c_str());
std::vector<CenterLine*> cLines = CenterLines.getValues();
std::vector<CenterLine*> newLines;
for (auto& cl: cLines) {