[TD]Remove old hatch on add new hatch

This commit is contained in:
wandererfan
2019-09-01 14:18:25 -04:00
committed by WandererFan
parent ee8ec4568b
commit 6a1b19739d
4 changed files with 150 additions and 14 deletions

View File

@@ -1058,15 +1058,23 @@ void QGIViewPart::toggleCosmeticLines(bool state)
}
}
//get hatchObj for face i if it exists
TechDraw::DrawHatch* QGIViewPart::faceIsHatched(int i,std::vector<TechDraw::DrawHatch*> hatchObjs) const
{
TechDraw::DrawHatch* result = nullptr;
bool found = false;
for (auto& h:hatchObjs) {
const std::vector<std::string> &sourceNames = h->Source.getSubValues();
int fdx = TechDraw::DrawUtil::getIndexFromName(sourceNames.at(0));
if (fdx == i) {
result = h;
for (auto& s: sourceNames) {
// int fdx = TechDraw::DrawUtil::getIndexFromName(sourceNames.at(0)); //this sb a loop through all subs
int fdx = TechDraw::DrawUtil::getIndexFromName(s);
if (fdx == i) {
result = h;
found = true;
break;
}
}
if (found) {
break;
}
}