[TD] code optimization for DrawViewPart

Use same code for GeomHatch and Hatch in DrawViewPart as discussed here: https://forum.freecadweb.org/viewtopic.php?f=35&t=47536&start=10
This commit is contained in:
donovaly
2020-06-16 00:08:42 +02:00
committed by WandererFan
parent 9c0a35f48b
commit 6db5b9f3b5

View File

@@ -622,14 +622,11 @@ void DrawViewPart::extractFaces()
std::vector<TechDraw::DrawHatch*> DrawViewPart::getHatches() const
{
// Base::Console().Message("DVP::getHatches()\n");
std::vector<TechDraw::DrawHatch*> result;
std::vector<App::DocumentObject*> children = getInList();
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != children.end(); ++it) {
if ((*it)->isRemoving()) {
continue;
}
if ((*it)->getTypeId().isDerivedFrom(DrawHatch::getClassTypeId())) {
if ( ((*it)->getTypeId().isDerivedFrom(DrawHatch::getClassTypeId())) &&
(!(*it)->isRemoving()) ) {
TechDraw::DrawHatch* hatch = dynamic_cast<TechDraw::DrawHatch*>(*it);
result.push_back(hatch);
}
@@ -642,7 +639,7 @@ std::vector<TechDraw::DrawGeomHatch*> DrawViewPart::getGeomHatches() const
std::vector<TechDraw::DrawGeomHatch*> result;
std::vector<App::DocumentObject*> children = getInList();
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != children.end(); ++it) {
if ( ((*it)->getTypeId().isDerivedFrom(DrawGeomHatch::getClassTypeId())) &&
if ( ((*it)->getTypeId().isDerivedFrom(DrawGeomHatch::getClassTypeId())) &&
(!(*it)->isRemoving()) ) {
TechDraw::DrawGeomHatch* geom = dynamic_cast<TechDraw::DrawGeomHatch*>(*it);
result.push_back(geom);