forked from FreeCAD/FreeCAD
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request FreeCAD#15500 from bgbsww/bgbsww-toponamingSaveRes…
…tore3 Toponaming: refactor getExportElementName to separate method
- Loading branch information
Showing
13 changed files
with
206 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
#include <bitset> | ||
|
||
#include <Mod/Part/App/Geometry.h> | ||
#include <Mod/Part/App/GeometryMigrationExtension.h> | ||
#include <Mod/Sketcher/SketcherGlobal.h> | ||
|
||
|
||
|
@@ -40,18 +41,29 @@ class ISketchExternalGeometryExtension | |
// START_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) | ||
// <[email protected]> | ||
virtual bool testFlag(int flag) const = 0; | ||
|
||
virtual void setFlag(int flag, bool v = true) = 0; | ||
|
||
virtual unsigned long getFlags() const = 0; | ||
|
||
virtual void setFlags(unsigned long flags) = 0; | ||
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) | ||
// <[email protected]> | ||
|
||
virtual bool isClear() const = 0; | ||
|
||
virtual size_t flagSize() const = 0; | ||
|
||
virtual const std::string& getRef() const = 0; | ||
|
||
virtual void setRef(const std::string& ref) = 0; | ||
|
||
virtual int getRefIndex() const = 0; | ||
|
||
virtual void setRefIndex(int index) = 0; | ||
}; | ||
|
||
class SketcherExport ExternalGeometryExtension: public Part::GeometryPersistenceExtension, | ||
class SketcherExport ExternalGeometryExtension: public Part::GeometryMigrationPersistenceExtension, | ||
private ISketchExternalGeometryExtension | ||
{ | ||
TYPESYSTEM_HEADER_WITH_OVERRIDE(); | ||
|
@@ -76,6 +88,7 @@ class SketcherExport ExternalGeometryExtension: public Part::GeometryPersistence | |
|
||
public: | ||
ExternalGeometryExtension() = default; | ||
|
||
~ExternalGeometryExtension() override = default; | ||
|
||
std::unique_ptr<Part::GeometryExtension> copy() const override; | ||
|
@@ -88,17 +101,29 @@ class SketcherExport ExternalGeometryExtension: public Part::GeometryPersistence | |
{ | ||
return Flags.test((size_t)(flag)); | ||
} | ||
|
||
void setFlag(int flag, bool v = true) override | ||
{ | ||
Flags.set((size_t)(flag), v); | ||
} | ||
|
||
unsigned long getFlags() const override | ||
{ | ||
return Flags.to_ulong(); | ||
} | ||
|
||
void setFlags(unsigned long flags) override | ||
{ | ||
Flags = flags; | ||
} | ||
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) | ||
// <[email protected]> | ||
|
||
bool isClear() const override | ||
{ | ||
return Flags.none(); | ||
} | ||
|
||
size_t flagSize() const override | ||
{ | ||
return Flags.size(); | ||
|
@@ -108,18 +133,33 @@ class SketcherExport ExternalGeometryExtension: public Part::GeometryPersistence | |
{ | ||
return Ref; | ||
} | ||
|
||
void setRef(const std::string& ref) override | ||
{ | ||
Ref = ref; | ||
} | ||
|
||
int getRefIndex() const override | ||
{ | ||
return RefIndex; | ||
} | ||
|
||
void setRefIndex(int index) override | ||
{ | ||
RefIndex = index; | ||
} | ||
|
||
static bool getFlagsFromName(std::string str, ExternalGeometryExtension::Flag& flag); | ||
|
||
protected: | ||
void copyAttributes(Part::GeometryExtension* cpy) const override; | ||
|
||
void restoreAttributes(Base::XMLReader& reader) override; | ||
|
||
void saveAttributes(Base::Writer& writer) const override; | ||
|
||
void preSave(Base::Writer& writer) const override; | ||
|
||
private: | ||
ExternalGeometryExtension(const ExternalGeometryExtension&) = default; | ||
|
||
|
@@ -128,6 +168,7 @@ class SketcherExport ExternalGeometryExtension: public Part::GeometryPersistence | |
// START_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) | ||
// <[email protected]> | ||
std::string Ref; | ||
int RefIndex = -1; | ||
FlagType Flags; | ||
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) | ||
// <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.