GeoFeaturertDesign/Gui: Add recompute sizes and datums to the body vp
This commit is contained in:
parent
0c620cc885
commit
d4c67c0366
|
@ -24,9 +24,9 @@
|
|||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <boost/bind.hpp>
|
||||
# include <Inventor/nodes/SoSeparator.h>
|
||||
# include <Inventor/actions/SoGetBoundingBoxAction.h>
|
||||
# include <Inventor/SbBox3d.h>
|
||||
# include <Precision.hxx>
|
||||
#endif
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
|||
#include <Gui/View3DInventor.h>
|
||||
#include <Gui/View3DInventorViewer.h>
|
||||
#include <Gui/ViewProviderOrigin.h>
|
||||
#include <Gui/ViewProviderOriginFeature.h>
|
||||
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
#include <Mod/PartDesign/App/FeatureSketchBased.h>
|
||||
|
@ -89,6 +90,18 @@ void ViewProviderBody::attach(App::DocumentObject *pcFeat)
|
|||
|
||||
addDisplayMaskMode(pcBodyChildren, "Through");
|
||||
addDisplayMaskMode(pcBodyTip, "Tip");
|
||||
|
||||
App::Document *adoc = pcObject->getDocument ();
|
||||
Gui::Document *gdoc = Gui::Application::Instance->getDocument ( adoc ) ;
|
||||
|
||||
assert ( adoc );
|
||||
assert ( gdoc );
|
||||
|
||||
connectChangedObjectApp = adoc->signalChangedObject.connect (
|
||||
boost::bind ( &ViewProviderBody::slotChangedObjectApp, this, _1) );
|
||||
|
||||
connectChangedObjectGui = gdoc->signalChangedObject.connect (
|
||||
boost::bind ( &ViewProviderBody::slotChangedObjectGui, this, _1) );
|
||||
}
|
||||
|
||||
// TODO on activating the body switch to the "Through" mode (2015-09-05, Fat-Zer)
|
||||
|
@ -254,6 +267,28 @@ void ViewProviderBody::updateData(const App::Property* prop)
|
|||
PartGui::ViewProviderPart::updateData(prop);
|
||||
}
|
||||
|
||||
|
||||
void ViewProviderBody::slotChangedObjectApp ( const App::DocumentObject& obj ) {
|
||||
PartDesign::Body *body = static_cast<PartDesign::Body*> ( getObject() );
|
||||
if ( body && body->hasFeature (&obj ) ) {
|
||||
updateOriginDatumSize ();
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderBody::slotChangedObjectGui ( const Gui::ViewProviderDocumentObject& vp ) {
|
||||
if ( !vp.isDerivedFrom ( Gui::ViewProviderOrigin::getClassTypeId () ) &&
|
||||
!vp.isDerivedFrom ( Gui::ViewProviderOriginFeature::getClassTypeId () ) ) {
|
||||
// Ignore origins to avoid infinite recursion (not likely in a well-formed document,
|
||||
// but may happen in documents designed in old versions of assembly branch )
|
||||
PartDesign::Body *body = static_cast<PartDesign::Body*> ( getObject() );
|
||||
App::DocumentObject *obj = vp.getObject ();
|
||||
|
||||
if ( body && obj && body->hasFeature ( obj ) ) {
|
||||
updateOriginDatumSize ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderBody::updateOriginDatumSize () {
|
||||
PartDesign::Body *body = static_cast<PartDesign::Body *> ( getObject() );
|
||||
// Use different bounding boxes for datums and for origins:
|
||||
|
|
|
@ -73,6 +73,11 @@ public:
|
|||
* @note datums are counted as their base point only
|
||||
*/
|
||||
SbBox3f getBoundBox ();
|
||||
|
||||
protected:
|
||||
void slotChangedObjectApp ( const App::DocumentObject& obj );
|
||||
void slotChangedObjectGui ( const Gui::ViewProviderDocumentObject& obj );
|
||||
|
||||
private:
|
||||
/// group used to store children collected by claimChildren3D() in the through (edit) mode.
|
||||
SoGroup *pcBodyChildren;
|
||||
|
@ -81,6 +86,9 @@ private:
|
|||
|
||||
/// Update the children's highlighting
|
||||
//void updateTree();
|
||||
|
||||
boost::signals::connection connectChangedObjectApp;
|
||||
boost::signals::connection connectChangedObjectGui;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user