[TD]use correct property type for directions

This commit is contained in:
wandererfan
2025-03-02 08:06:46 -05:00
parent bec9c2e405
commit 8ec5ebeba7
2 changed files with 32 additions and 3 deletions

View File

@@ -1042,6 +1042,7 @@ bool DrawViewPart::hasGeometry() const
const std::vector<TechDraw::VertexPtr>& verts = getVertexGeometry();
const std::vector<TechDraw::BaseGeomPtr>& edges = getEdgeGeometry();
return !(verts.empty() && edges.empty());
}
@@ -1477,6 +1478,33 @@ void DrawViewPart::resetReferenceVerts()
addReferencesToGeom();
}
void DrawViewPart::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop)
{
if (prop == &Direction) {
// Direction was PropertyVector but is now PropertyDirection
App::PropertyVector tmp;
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
tmp.setContainer(this);
tmp.Restore(reader);
auto tmpValue = tmp.getValue();
Direction.setValue(tmpValue);
}
return;
}
if (prop == &XDirection) {
// XDirection was PropertyFloat but is now PropertyLength
App::PropertyVector tmp;
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
tmp.setContainer(this);
tmp.Restore(reader);
auto tmpValue = tmp.getValue();
XDirection.setValue(tmpValue);
}
return;
}
}
// debugging ----------------------------------------------------------------------------
void DrawViewPart::dumpVerts(std::string text)