Warn if Anchor view deleted in Projection Group

This commit is contained in:
WandererFan 2017-01-06 09:36:03 -05:00
parent 1738107590
commit 0204b77766
3 changed files with 19 additions and 5 deletions

View File

@ -496,6 +496,11 @@ int DrawProjGroup::removeProjection(const char *viewProjType)
auto projPtr( dynamic_cast<TechDraw::DrawProjGroupItem *>(it) );
if( projPtr ) {
if ( strcmp(viewProjType, projPtr->Type.getValueAsString()) == 0 ) {
if( strcmp(viewProjType,"Front") == 0 ) {
Base::Console().Warning("DPG - %s: Front projection deleted. Projection group may be corrupt\n",
getNameInDocument());
Anchor.setValue(nullptr);
}
removeView(projPtr); // Remove from collection
getDocument()->remObject( it->getNameInDocument() ); // Remove from the document
moveToCentre();

View File

@ -160,6 +160,19 @@ double DrawProjGroupItem::getRotateAngle()
return angle;
}
void DrawProjGroupItem::unsetupObject()
{
if (getGroup() != nullptr) {
if (getGroup()->hasProjection(Type.getValueAsString()) ) {
if (getGroup()->getAnchor() == this) {
Base::Console().Warning("Warning - DPG (%s/%s) may be corrupt - Anchor deleted\n",
getGroup()->getNameInDocument(),getGroup()->Label.getValue());
getGroup()->Anchor.setValue(nullptr);
}
}
}
}
PyObject *DrawProjGroupItem::getPyObject(void)
{
if (PythonObject.is(Py::_None())) {

View File

@ -59,12 +59,8 @@ public:
App::PropertyVector RotationVector;
short mustExecute() const;
/** @name methods overide Feature */
//@{
/// recalculate the Feature
virtual void onDocumentRestored();
// virtual App::DocumentObjectExecReturn *execute(void); // TODO: Delete me too if we take out the implementation
//@}
virtual void unsetupObject();
DrawProjGroup* getGroup(void) const;
double getRotateAngle();