[FEM] fix unit handling of line filter

- in contrary to other filters the properties have no unit handling
(there are several bugs in line filter and to fix them, unit handling is necessary)
This commit is contained in:
Uwe
2022-06-10 14:17:42 +02:00
parent 6e1fc33efd
commit 8bcab38d76
4 changed files with 211 additions and 189 deletions

View File

@@ -236,6 +236,24 @@ DocumentObjectExecReturn* FemPostDataAlongLineFilter::execute(void) {
return Fem::FemPostFilter::execute();
}
void FemPostDataAlongLineFilter::handleChangedPropertyType(Base::XMLReader& reader, const char* TypeName, App::Property* prop)
// transforms properties that had been changed
{
// property Point1 had the App::PropertyVector and was changed to App::PropertyVectorDistance
if (prop == &Point1 && strcmp(TypeName, "App::PropertyVector") == 0) {
App::PropertyVector Point1Property;
// restore the PropertyFloat to be able to set its value
Point1Property.Restore(reader);
Point1.setValue(Point1Property.getValue());
}
// property Point2 had the App::PropertyVector and was changed to App::PropertyVectorDistance
else if (prop == &Point2 && strcmp(TypeName, "App::PropertyVector") == 0) {
App::PropertyVector Point2Property;
Point2Property.Restore(reader);
Point2.setValue(Point2Property.getValue());
}
}
void FemPostDataAlongLineFilter::onChanged(const Property* prop) {
if (prop == &Point1) {

View File

@@ -106,12 +106,12 @@ public:
FemPostDataAlongLineFilter(void);
virtual ~FemPostDataAlongLineFilter();
App::PropertyVector Point2;
App::PropertyVector Point1;
App::PropertyInteger Resolution;
App::PropertyFloatList XAxisData;
App::PropertyFloatList YAxisData;
App::PropertyString PlotData;
App::PropertyVectorDistance Point1;
App::PropertyVectorDistance Point2;
App::PropertyInteger Resolution;
App::PropertyFloatList XAxisData;
App::PropertyFloatList YAxisData;
App::PropertyString PlotData;
virtual const char* getViewProviderName(void) const {
return "FemGui::ViewProviderFemPostDataAlongLine";
@@ -122,6 +122,7 @@ protected:
virtual App::DocumentObjectExecReturn* execute(void);
virtual void onChanged(const App::Property* prop);
void GetAxisData();
virtual void handleChangedPropertyType(Base::XMLReader& reader, const char* TypeName, App::Property* prop);
private: