Toponaming: import code related to ElementMapVersion from LS3

*Imported original code
This commit is contained in:
Zheng, Lei
2024-12-27 12:35:22 +01:00
committed by Vincenzo Calligaro
parent e5b1d05813
commit 89ec079fbf
7 changed files with 80 additions and 3 deletions

View File

@@ -48,6 +48,11 @@ PROPERTY_SOURCE(App::GeoFeature, App::DocumentObject)
GeoFeature::GeoFeature()
{
ADD_PROPERTY_TYPE(Placement, (Base::Placement()), nullptr, Prop_NoRecompute, nullptr);
ADD_PROPERTY_TYPE(_ElementMapVersion,
(""),
"Base",
(App::PropertyType)(Prop_Output | Prop_Hidden | Prop_Transient),
"");
}
GeoFeature::~GeoFeature() = default;
@@ -244,6 +249,16 @@ void GeoFeature::updateElementReference()
return;
}
bool reset = false;
auto version = getElementMapVersion(prop);
if (_ElementMapVersion.getStrValue().empty()) {
_ElementMapVersion.setValue(version);
}
else if (_ElementMapVersion.getStrValue() != version) {
reset = true;
_ElementMapVersion.setValue(version);
}
PropertyLinkBase::updateElementReferences(this, reset);
}
@@ -258,6 +273,14 @@ void GeoFeature::onChanged(const Property* prop)
DocumentObject::onChanged(prop);
}
void GeoFeature::onDocumentRestored()
{
if (!getDocument()->testStatus(Document::Status::Importing)) {
_ElementMapVersion.setValue(getElementMapVersion(getPropertyOfGeometry(), true));
}
DocumentObject::onDocumentRestored();
}
const std::vector<std::string>& GeoFeature::searchElementCache(const std::string& element,
Data::SearchOptions options,
double tol,