add method to create new tag id
This commit is contained in:
@@ -183,17 +183,7 @@ TYPESYSTEM_SOURCE_ABSTRACT(Part::Geometry,Base::Persistence)
|
||||
Geometry::Geometry()
|
||||
: Construction(false)
|
||||
{
|
||||
// Initialize a random number generator, to avoid Valgrind false positives.
|
||||
static boost::mt19937 ran;
|
||||
static bool seeded = false;
|
||||
|
||||
if (!seeded) {
|
||||
ran.seed(static_cast<unsigned int>(std::time(0)));
|
||||
seeded = true;
|
||||
}
|
||||
static boost::uuids::basic_random_generator<boost::mt19937> gen(&ran);
|
||||
|
||||
tag = gen();
|
||||
createNewTag();
|
||||
}
|
||||
|
||||
Geometry::~Geometry()
|
||||
@@ -225,6 +215,21 @@ boost::uuids::uuid Geometry::getTag() const
|
||||
return tag;
|
||||
}
|
||||
|
||||
void Geometry::createNewTag()
|
||||
{
|
||||
// Initialize a random number generator, to avoid Valgrind false positives.
|
||||
static boost::mt19937 ran;
|
||||
static bool seeded = false;
|
||||
|
||||
if (!seeded) {
|
||||
ran.seed(static_cast<unsigned int>(std::time(0)));
|
||||
seeded = true;
|
||||
}
|
||||
static boost::uuids::basic_random_generator<boost::mt19937> gen(&ran);
|
||||
|
||||
tag = gen();
|
||||
}
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
TYPESYSTEM_SOURCE(Part::GeomPoint,Part::Geometry)
|
||||
|
||||
@@ -87,6 +87,8 @@ public:
|
||||
bool Construction;
|
||||
/// returns the tag of the geometry object
|
||||
boost::uuids::uuid getTag() const;
|
||||
/// create a new tag for the geometry object
|
||||
void createNewTag();
|
||||
|
||||
protected:
|
||||
Geometry();
|
||||
|
||||
Reference in New Issue
Block a user