inherit FemAnalysis from DocumentObjectGroup and remove Member property

This commit is contained in:
wmayer
2017-10-11 22:04:07 +02:00
parent 8f8f890259
commit ce6809415b
35 changed files with 112 additions and 142 deletions

View File

@@ -35,13 +35,12 @@
using namespace Fem;
using namespace App;
PROPERTY_SOURCE(Fem::FemAnalysis, App::DocumentObject)
PROPERTY_SOURCE(Fem::FemAnalysis, App::DocumentObjectGroup)
FemAnalysis::FemAnalysis()
{
Base::Uuid id;
ADD_PROPERTY_TYPE(Member,(0), "Analysis member",Prop_None,"All objects belonging to the Analysis");
ADD_PROPERTY_TYPE(Uid,(id),0,App::Prop_None,"UUID of the Analysis");
}
@@ -56,16 +55,12 @@ short FemAnalysis::mustExecute(void) const
PyObject *FemAnalysis::getPyObject()
{
if (PythonObject.is(Py::_None())){
// ref counter is set to 1
PythonObject = Py::Object(new DocumentObjectPy(this),true);
}
return Py::new_reference_to(PythonObject);
return App::DocumentObjectGroup::getPyObject();
}
void FemAnalysis::onChanged(const Property* prop)
{
App::DocumentObject::onChanged(prop);
App::DocumentObjectGroup::onChanged(prop);
}

View File

@@ -25,7 +25,7 @@
#define Fem_FemAnalysis_H
#include <App/DocumentObject.h>
#include <App/DocumentObjectGroup.h>
#include <App/PropertyLinks.h>
#include <App/FeaturePython.h>
@@ -34,7 +34,7 @@
namespace Fem
{
class AppFemExport FemAnalysis : public App::DocumentObject
class AppFemExport FemAnalysis : public App::DocumentObjectGroup
{
PROPERTY_HEADER(Fem::FemAnalysis);
@@ -53,8 +53,6 @@ public:
virtual short mustExecute(void) const;
virtual PyObject *getPyObject(void);
/// Member objects of the Analysis
App::PropertyLinkList Member;
/// unique identifier of the Analysis
App::PropertyUUID Uid;

View File

@@ -451,7 +451,7 @@ App::DocumentObject* getObjectByType(const Base::Type type)
}
if(obj->getTypeId() == FemAnalysis::getClassTypeId())
{
std::vector<App::DocumentObject*> fem = (static_cast<FemAnalysis*>(obj))->Member.getValues();
std::vector<App::DocumentObject*> fem = (static_cast<FemAnalysis*>(obj))->Group.getValues();
for (std::vector<App::DocumentObject*>::iterator it = fem.begin(); it != fem.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(type))
return static_cast<App::DocumentObject*>(*it); // return the first of that type
@@ -472,10 +472,8 @@ App::DocumentObject* createObjectByType(const Base::Type type)
if(obj->getTypeId() == FemAnalysis::getClassTypeId())
{
std::vector<App::DocumentObject*> fem = (static_cast<FemAnalysis*>(obj))->Member.getValues();
App::DocumentObject* newobj = pcDoc->addObject(type.getName());
fem.push_back(newobj); // FemAnalysis is not a DocumentGroup derived class but DocumentObject
(static_cast<FemAnalysis*>(obj))->Member.setValues(fem);
static_cast<FemAnalysis*>(obj)->addObject(newobj);
return newobj;
}
else