[TD]use correct property type for directions
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -90,9 +90,8 @@ public:
|
||||
|
||||
App::PropertyLinkList Source;
|
||||
App::PropertyXLinkList XSource;
|
||||
App::PropertyVector
|
||||
Direction;//TODO: Rename to YAxisDirection or whatever this actually is (ProjectionDirection)
|
||||
App::PropertyVector XDirection;
|
||||
App::PropertyDirection Direction; // the projection direction
|
||||
App::PropertyDirection XDirection;
|
||||
App::PropertyBool Perspective;
|
||||
App::PropertyDistance Focus;
|
||||
|
||||
@@ -115,6 +114,8 @@ public:
|
||||
App::DocumentObjectExecReturn* execute() override;
|
||||
const char* getViewProviderName() const override { return "TechDrawGui::ViewProviderViewPart"; }
|
||||
PyObject* getPyObject() override;
|
||||
void handleChangedPropertyType(
|
||||
Base::XMLReader &reader, const char * TypeName, App::Property * prop) override;
|
||||
|
||||
static TopoDS_Shape centerScaleRotate(const DrawViewPart* dvp, TopoDS_Shape& inOutShape,
|
||||
Base::Vector3d centroid);
|
||||
|
||||
Reference in New Issue
Block a user