[TD]remove Hatches from Display when deleted
This commit is contained in:
@@ -596,6 +596,7 @@ void DrawGeomHatch::setupPatIncluded(void)
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: replace with FileInfo copy
|
||||
//copy whole text file from inSpec to outSpec
|
||||
void DrawGeomHatch::copyFile(std::string inSpec, std::string outSpec)
|
||||
{
|
||||
@@ -609,6 +610,18 @@ void DrawGeomHatch::copyFile(std::string inSpec, std::string outSpec)
|
||||
}
|
||||
}
|
||||
|
||||
void DrawGeomHatch::unsetupObject(void)
|
||||
{
|
||||
// Base::Console().Message("DGH::unsetupObject() - status: %lu removing: %d \n", getStatus(), isRemoving());
|
||||
App::DocumentObject* source = Source.getValue();
|
||||
DrawView* dv = dynamic_cast<DrawView*>(source);
|
||||
if (dv != nullptr) {
|
||||
dv->requestPaint();
|
||||
}
|
||||
App::DocumentObject::unsetupObject();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ public:
|
||||
return "TechDrawGui::ViewProviderGeomHatch";
|
||||
}
|
||||
virtual PyObject *getPyObject(void) override;
|
||||
virtual void unsetupObject(void) override;
|
||||
|
||||
|
||||
DrawViewPart* getSourceView(void) const;
|
||||
|
||||
|
||||
@@ -280,6 +280,17 @@ void DrawHatch::copyFile(std::string inSpec, std::string outSpec)
|
||||
}
|
||||
}
|
||||
|
||||
void DrawHatch::unsetupObject(void)
|
||||
{
|
||||
// Base::Console().Message("DH::unsetupObject() - status: %lu removing: %d \n", getStatus(), isRemoving());
|
||||
App::DocumentObject* source = Source.getValue();
|
||||
DrawView* dv = dynamic_cast<DrawView*>(source);
|
||||
if (dv != nullptr) {
|
||||
dv->requestPaint();
|
||||
}
|
||||
App::DocumentObject::unsetupObject();
|
||||
}
|
||||
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ public:
|
||||
virtual const char* getViewProviderName(void) const override {
|
||||
return "TechDrawGui::ViewProviderHatch";
|
||||
}
|
||||
virtual void unsetupObject(void) override;
|
||||
|
||||
//return PyObject as DrawHatchPy
|
||||
virtual PyObject *getPyObject(void) override;
|
||||
|
||||
|
||||
@@ -620,7 +620,8 @@ std::vector<TechDraw::DrawHatch*> DrawViewPart::getHatches() const
|
||||
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)->getTypeId().isDerivedFrom(DrawHatch::getClassTypeId())) {
|
||||
if ( ((*it)->getTypeId().isDerivedFrom(DrawHatch::getClassTypeId())) &&
|
||||
(!(*it)->isRemoving()) ) {
|
||||
TechDraw::DrawHatch* hatch = dynamic_cast<TechDraw::DrawHatch*>(*it);
|
||||
result.push_back(hatch);
|
||||
}
|
||||
@@ -633,7 +634,8 @@ 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user