Transfer in code from linkstage3
This commit is contained in:
@@ -498,6 +498,7 @@ PyMOD_INIT_FUNC(Part)
|
||||
Part::GeometryBoolExtension ::init();
|
||||
Part::GeometryDoubleExtension ::init();
|
||||
Part::GeometryMigrationExtension ::init();
|
||||
Part::GeometryMigrationPersistenceExtension ::init();
|
||||
Part::Geometry ::init();
|
||||
Part::GeomPoint ::init();
|
||||
Part::GeomCurve ::init();
|
||||
|
||||
@@ -29,14 +29,22 @@
|
||||
|
||||
using namespace Part;
|
||||
|
||||
TYPESYSTEM_SOURCE_ABSTRACT(Part::GeometryMigrationPersistenceExtension, Part::GeometryPersistenceExtension)
|
||||
|
||||
//---------- Geometry Extension
|
||||
TYPESYSTEM_SOURCE(Part::GeometryMigrationExtension,Part::GeometryExtension)
|
||||
|
||||
|
||||
void GeometryMigrationExtension::copyAttributes(Part::GeometryExtension * cpy) const
|
||||
{
|
||||
Part::GeometryExtension::copyAttributes(cpy);
|
||||
static_cast<GeometryMigrationExtension *>(cpy)->ConstructionState = this->ConstructionState;
|
||||
static_cast<GeometryMigrationExtension *>(cpy)->GeometryMigrationFlags = this->GeometryMigrationFlags;
|
||||
|
||||
static_cast<GeometryMigrationExtension *>(cpy)->Id = this->Id;
|
||||
static_cast<GeometryMigrationExtension *>(cpy)->Flags = this->Flags;
|
||||
static_cast<GeometryMigrationExtension *>(cpy)->Ref = this->Ref;
|
||||
static_cast<GeometryMigrationExtension *>(cpy)->RefIndex = this->RefIndex;
|
||||
}
|
||||
|
||||
std::unique_ptr<Part::GeometryExtension> GeometryMigrationExtension::copy() const
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
enum MigrationType {
|
||||
None = 0,
|
||||
Construction = 1,
|
||||
GeometryId = 2,
|
||||
ExternalReference = 3,
|
||||
NumMigrationType // Must be the last
|
||||
};
|
||||
|
||||
@@ -61,7 +63,21 @@ public:
|
||||
|
||||
|
||||
virtual bool getConstruction() const {return ConstructionState;}
|
||||
virtual void setConstruction(bool construction) {ConstructionState = construction;}
|
||||
virtual void setConstruction(bool construction)
|
||||
{ConstructionState = construction; setMigrationType(Construction);}
|
||||
|
||||
long getId() const {return Id;}
|
||||
void setId(long id) {Id = id; setMigrationType(GeometryId);}
|
||||
|
||||
const std::string &getRef() const {return Ref;}
|
||||
int getRefIndex() const {return RefIndex;}
|
||||
unsigned long getFlags() const {return Flags;}
|
||||
void setReference(const char *ref, int index, unsigned long flags) {
|
||||
Ref = ref ? ref : "";
|
||||
RefIndex = index;
|
||||
Flags = flags;
|
||||
setMigrationType(ExternalReference);
|
||||
}
|
||||
|
||||
virtual bool testMigrationType(int flag) const { return GeometryMigrationFlags.test((size_t)(flag)); };
|
||||
virtual void setMigrationType(int flag, bool v=true) { GeometryMigrationFlags.set((size_t)(flag), v); };
|
||||
@@ -76,7 +92,21 @@ private:
|
||||
using MigrationTypeFlagType = std::bitset<32>;
|
||||
MigrationTypeFlagType GeometryMigrationFlags;
|
||||
bool ConstructionState{false};
|
||||
long Id = 0;
|
||||
int RefIndex = -1;
|
||||
unsigned long Flags = 0;
|
||||
std::string Ref;
|
||||
};
|
||||
|
||||
|
||||
class PartExport GeometryMigrationPersistenceExtension : public Part::GeometryPersistenceExtension
|
||||
{
|
||||
TYPESYSTEM_HEADER();
|
||||
public:
|
||||
// Called to save data as attributes in 'Geometry' XML tag
|
||||
virtual void preSave(Base::Writer &/*writer*/) const {}
|
||||
// Called to save data after 'GeometryExtensions' XML elements
|
||||
virtual void postSave(Base::Writer &/*writer*/) const {}
|
||||
};
|
||||
|
||||
} //namespace Part
|
||||
|
||||
Reference in New Issue
Block a user