diff --git a/src/Mod/Part/App/GeometryMigrationExtension.cpp b/src/Mod/Part/App/GeometryMigrationExtension.cpp index 61cda8d6df..2ecebe6298 100644 --- a/src/Mod/Part/App/GeometryMigrationExtension.cpp +++ b/src/Mod/Part/App/GeometryMigrationExtension.cpp @@ -35,11 +35,10 @@ TYPESYSTEM_SOURCE_ABSTRACT(Part::GeometryMigrationPersistenceExtension, Part::Ge TYPESYSTEM_SOURCE(Part::GeometryMigrationExtension,Part::GeometryExtension) -void GeometryMigrationExtension::copyAttributes(Part::GeometryExtension * cpy) const -{ +void GeometryMigrationExtension::copyAttributes(Part::GeometryExtension *cpy) const { Part::GeometryExtension::copyAttributes(cpy); static_cast(cpy)->ConstructionState = this->ConstructionState; - static_cast(cpy)->GeometryMigrationFlags = this->GeometryMigrationFlags; + static_cast(cpy)->GeometryMigrationFlags = this->GeometryMigrationFlags; static_cast(cpy)->Id = this->Id; static_cast(cpy)->Flags = this->Flags; diff --git a/src/Mod/Part/App/GeometryMigrationExtension.h b/src/Mod/Part/App/GeometryMigrationExtension.h index edfaddd8cb..59375ee4f3 100644 --- a/src/Mod/Part/App/GeometryMigrationExtension.h +++ b/src/Mod/Part/App/GeometryMigrationExtension.h @@ -62,16 +62,26 @@ public: PyObject *getPyObject() override; - virtual bool getConstruction() const {return ConstructionState;} - virtual void setConstruction(bool construction) - {ConstructionState = construction; setMigrationType(Construction);} + virtual bool getConstruction() const { return ConstructionState; } - long getId() const {return Id;} - void setId(long id) {Id = id; setMigrationType(GeometryId);} + 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; } - 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; @@ -103,9 +113,9 @@ class PartExport GeometryMigrationPersistenceExtension : public Part::GeometryPe { TYPESYSTEM_HEADER(); public: - // Called to save data as attributes in 'Geometry' XML tag + // Called to extend 'Geometry' XML tag with additional attributes (eg Id) virtual void preSave(Base::Writer &/*writer*/) const {} - // Called to save data after 'GeometryExtensions' XML elements + // Called to add additional tag after 'GeometryExtensions' XML elements (eg Construction flag) virtual void postSave(Base::Writer &/*writer*/) const {} }; diff --git a/src/Mod/Sketcher/App/ExternalGeometryFacade.cpp b/src/Mod/Sketcher/App/ExternalGeometryFacade.cpp index ec7dbb7cc8..6a4d249ba2 100644 --- a/src/Mod/Sketcher/App/ExternalGeometryFacade.cpp +++ b/src/Mod/Sketcher/App/ExternalGeometryFacade.cpp @@ -170,7 +170,7 @@ void ExternalGeometryFacade::copyFlags(const Part::Geometry* src, Part::Geometry void ExternalGeometryFacade::setRef(const std::string& ref) { - if (ref.size() && getId() < 0) { + if (ref.empty() && getId() < 0) { FC_ERR("Cannot set reference on root geometries"); } else { @@ -178,14 +178,6 @@ void ExternalGeometryFacade::setRef(const std::string& ref) } } -// void ExternalGeometryFacade::setRef(const std::string &ref) -//{ -// if (ref.size() && getId() < 0) -// FC_ERR("Cannot set reference on root geometries"); -// else -// getExternalGeoExt()->setRef(ref); -// } - PyObject* ExternalGeometryFacade::getPyObject() { return new ExternalGeometryFacadePy(new ExternalGeometryFacade(this->Geo)); diff --git a/src/Mod/Sketcher/App/ExternalGeometryFacade.h b/src/Mod/Sketcher/App/ExternalGeometryFacade.h index c1c9cce6df..ac2c2b7dfd 100644 --- a/src/Mod/Sketcher/App/ExternalGeometryFacade.h +++ b/src/Mod/Sketcher/App/ExternalGeometryFacade.h @@ -78,6 +78,7 @@ public: { return getExternalGeoExt()->testFlag(flag); } + void setFlag(int flag, bool v = true) override { getExternalGeoExt()->setFlag(flag, v); @@ -87,6 +88,7 @@ public: { return getExternalGeoExt()->getFlags(); } + void setFlags(unsigned long flags) override { getExternalGeoExt()->setFlags(flags); @@ -96,6 +98,7 @@ public: { return getExternalGeoExt()->isClear(); } + size_t flagSize() const override { return getExternalGeoExt()->flagSize(); @@ -105,6 +108,7 @@ public: { return getExternalGeoExt()->getRef(); } + void setRef(const std::string& ref) override; int getRefIndex() const override