Part/Sketcher: Refactor Geometry Extensions copy/save/restore AND attachment notification

=========================================================================================

- Long overdue refactor to avoid repetition during save/restore and copy.
- New interface to notify an extension when it is attached. It also enables the extension to gain
a pointer to the geometry container. This is intended to extend the functionality already existing
in Part::Geometry.
This commit is contained in:
Abdullah Tahiri
2021-01-08 14:18:52 +01:00
committed by abdullahtahiriyo
parent 927fdc9edc
commit e6af511f39
14 changed files with 141 additions and 84 deletions

View File

@@ -37,14 +37,18 @@ GeometryMigrationExtension::GeometryMigrationExtension():ConstructionState(false
}
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;
}
std::unique_ptr<Part::GeometryExtension> GeometryMigrationExtension::copy(void) const
{
auto cpy = std::make_unique<GeometryMigrationExtension>();
cpy->ConstructionState = this->ConstructionState;
cpy->GeometryMigrationFlags = this->GeometryMigrationFlags;
cpy->setName(this->getName()); // Base Class
copyAttributes(cpy.get());
#if defined (__GNUC__) && (__GNUC__ <=4)
return std::move(cpy);