Restructure the Assembly data model (again)...

This commit is contained in:
jriegel
2014-06-16 20:39:46 +02:00
committed by Stefan Tröger
parent 09fe593ae0
commit 608dddd998
23 changed files with 455 additions and 933 deletions

View File

@@ -93,47 +93,41 @@ std::vector<std::string> ViewProviderProductRef::getDisplayModes(void) const
std::vector<App::DocumentObject*> ViewProviderProductRef::claimChildren(void)const
{
std::vector<App::DocumentObject*> temp(static_cast<Assembly::Product*>(getObject())->Items.getValues());
temp.insert(temp.end(),
static_cast<Assembly::Product*>(getObject())->Annotations.getValues().begin(),
static_cast<Assembly::Product*>(getObject())->Annotations.getValues().end());
return temp;
return (static_cast<Assembly::Product*>(getObject())->Items.getValues());
}
std::vector<App::DocumentObject*> ViewProviderProductRef::claimChildren3D(void)const
{
return static_cast<Assembly::Product*>(getObject())->Items.getValues();
}
void ViewProviderProductRef::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
{
ViewProviderItem::setupContextMenu(menu, receiver, member); // call the base class
QAction* toggle = menu->addAction(QObject::tr("Rigid subassembly"), receiver, member);
toggle->setData(QVariant(1000)); // identifier
toggle->setCheckable(true);
toggle->setToolTip(QObject::tr("Set if the subassembly shall be solved as on part (rigid) or if all parts of this assembly are solved for themselfe."));
toggle->setStatusTip(QObject::tr("Set if the subassembly shall be solved as on part (rigid) or if all parts of this assembly are solved for themself."));
bool prop = static_cast<Assembly::Product*>(getObject())->Rigid.getValue();
toggle->setChecked(prop);
//QAction* toggle = menu->addAction(QObject::tr("Rigid subassembly"), receiver, member);
//toggle->setData(QVariant(1000)); // identifier
//toggle->setCheckable(true);
//toggle->setToolTip(QObject::tr("Set if the subassembly shall be solved as on part (rigid) or if all parts of this assembly are solved for themselfe."));
//toggle->setStatusTip(QObject::tr("Set if the subassembly shall be solved as on part (rigid) or if all parts of this assembly are solved for themself."));
//bool prop = static_cast<Assembly::Product*>(getObject())->Rigid.getValue();
//toggle->setChecked(prop);
}
bool ViewProviderProductRef::setEdit(int ModNum)
{
if(ModNum == 1000) { // identifier
Gui::Command::openCommand("Change subassembly solving behaviour");
if(!static_cast<Assembly::Product*>(getObject())->Rigid.getValue())
Gui::Command::doCommand(Gui::Command::Doc,"FreeCAD.getDocument(\"%s\").getObject(\"%s\").Rigid = True",getObject()->getDocument()->getName(), getObject()->getNameInDocument());
else
Gui::Command::doCommand(Gui::Command::Doc,"FreeCAD.getDocument(\"%s\").getObject(\"%s\").Rigid = False",getObject()->getDocument()->getName(), getObject()->getNameInDocument());
//if(ModNum == 1000) { // identifier
// Gui::Command::openCommand("Change subassembly solving behaviour");
// if(!static_cast<Assembly::Product*>(getObject())->Rigid.getValue())
// Gui::Command::doCommand(Gui::Command::Doc,"FreeCAD.getDocument(\"%s\").getObject(\"%s\").Rigid = True",getObject()->getDocument()->getName(), getObject()->getNameInDocument());
// else
// Gui::Command::doCommand(Gui::Command::Doc,"FreeCAD.getDocument(\"%s\").getObject(\"%s\").Rigid = False",getObject()->getDocument()->getName(), getObject()->getNameInDocument());
Gui::Command::commitCommand();
return false;
}
return ViewProviderItem::setEdit(ModNum); // call the base class
// Gui::Command::commitCommand();
// return false;
//}
//return ViewProviderItem::setEdit(ModNum); // call the base class
return false;
}
bool ViewProviderProductRef::allowDrop(const std::vector<const App::DocumentObject*> &objList,Qt::KeyboardModifiers keys,Qt::MouseButtons mouseBts,const QPoint &pos)