PartDesign Gui: Extend ViewProviderDatum with Part::ViewProviderAttachExtension
This commit is contained in:
@@ -78,13 +78,15 @@
|
||||
|
||||
using namespace PartDesignGui;
|
||||
|
||||
PROPERTY_SOURCE(PartDesignGui::ViewProviderDatum,Gui::ViewProviderGeometryObject)
|
||||
PROPERTY_SOURCE_WITH_EXTENSIONS(PartDesignGui::ViewProviderDatum,Gui::ViewProviderGeometryObject)
|
||||
|
||||
// static data
|
||||
const double ViewProviderDatum::defaultSize = Gui::ViewProviderOrigin::defaultSize ();
|
||||
|
||||
ViewProviderDatum::ViewProviderDatum()
|
||||
{
|
||||
PartGui::ViewProviderAttachExtension::initExtension(this);
|
||||
|
||||
pShapeSep = new SoSeparator();
|
||||
pShapeSep->ref();
|
||||
pPickStyle = new SoPickStyle();
|
||||
@@ -411,46 +413,3 @@ void ViewProviderDatum::setPickable(bool val) {
|
||||
else
|
||||
pPickStyle->style = SoPickStyle::UNPICKABLE;
|
||||
}
|
||||
|
||||
QIcon ViewProviderDatum::mergeOverlayIcons (const QIcon & orig) const
|
||||
{
|
||||
QIcon mergedicon = orig;
|
||||
|
||||
if (getObject()->hasExtension(Part::AttachExtension::getExtensionClassTypeId())) {
|
||||
|
||||
bool attached = false;
|
||||
|
||||
try{
|
||||
attached = getObject()->getExtensionByType<Part::AttachExtension>()->positionBySupport();
|
||||
}
|
||||
catch (...) { // We are just trying to get an icon, if no placement can be calculated, set unattached.
|
||||
// set unattached
|
||||
}
|
||||
|
||||
if(!attached) {
|
||||
QPixmap px;
|
||||
|
||||
static const char * const feature_detached_xpm[]={
|
||||
"9 9 3 1",
|
||||
". c None",
|
||||
"# c #cc00cc",
|
||||
"a c #ffffff",
|
||||
"...###...",
|
||||
".##aaa##.",
|
||||
"##aaaaa##",
|
||||
"##aaaaa##",
|
||||
"#########",
|
||||
"#########",
|
||||
"#########",
|
||||
".##aaa##.",
|
||||
".##aaa##.",
|
||||
"...###..."};
|
||||
|
||||
px = QPixmap(feature_detached_xpm);
|
||||
|
||||
mergedicon = mergePixmap(mergedicon, px, Gui::BitmapFactoryInst::BottomLeft);
|
||||
}
|
||||
}
|
||||
|
||||
return mergedicon;
|
||||
}
|
||||
|
||||
@@ -27,15 +27,17 @@
|
||||
#include "Gui/ViewProviderGeometryObject.h"
|
||||
#include <Base/BoundBox.h>
|
||||
|
||||
#include <Mod/Part/Gui/ViewProviderAttachExtension.h>
|
||||
|
||||
class SoPickStyle;
|
||||
class SbBox3f;
|
||||
class SoGetBoundingBoxAction;
|
||||
|
||||
namespace PartDesignGui {
|
||||
|
||||
class PartDesignGuiExport ViewProviderDatum : public Gui::ViewProviderGeometryObject
|
||||
class PartDesignGuiExport ViewProviderDatum : public Gui::ViewProviderGeometryObject, PartGui::ViewProviderAttachExtension
|
||||
{
|
||||
PROPERTY_HEADER(PartDesignGui::ViewProviderDatum);
|
||||
PROPERTY_HEADER_WITH_EXTENSIONS(PartDesignGui::ViewProviderDatum);
|
||||
|
||||
public:
|
||||
/// constructor
|
||||
@@ -124,8 +126,6 @@ protected:
|
||||
// Get the separator to fill with datum content
|
||||
SoSeparator *getShapeRoot () { return pShapeSep; }
|
||||
|
||||
virtual QIcon mergeOverlayIcons (const QIcon & orig) const override;
|
||||
|
||||
private:
|
||||
SoSeparator* pShapeSep;
|
||||
SoPickStyle* pPickStyle;
|
||||
|
||||
Reference in New Issue
Block a user