Fem: Remove property name comparison

This commit is contained in:
marioalexis
2023-03-11 20:39:26 -03:00
committed by wwmayer
parent d37f7a79ca
commit 21aee496ef
16 changed files with 31 additions and 30 deletions

View File

@@ -108,10 +108,10 @@ void ViewProviderFemConstraintBearing::updateData(const App::Property* prop)
// Gets called whenever a property of the attached object changes
Fem::ConstraintBearing *pcConstraint = static_cast<Fem::ConstraintBearing *>(this->getObject());
if (strcmp(prop->getName(),"References") == 0)
if (prop == &pcConstraint->References)
Base::Console().Error("\n"); // enable a breakpoint here
if (strcmp(prop->getName(),"BasePoint") == 0) {
if (prop == &pcConstraint->BasePoint) {
// Remove and recreate the symbol
Gui::coinRemoveAllChildren(pShapeSep);
@@ -128,7 +128,7 @@ void ViewProviderFemConstraintBearing::updateData(const App::Property* prop)
createPlacement(pShapeSep, b, rot);
pShapeSep->addChild(
createFixed(radius / 2, radius / 2 * 1.5, pcConstraint->AxialFree.getValue()));
} else if (strcmp(prop->getName(),"AxialFree") == 0) {
} else if (prop == &pcConstraint->AxialFree) {
if (pShapeSep->getNumChildren() > 0) {
// Change the symbol
Base::Vector3d normal = pcConstraint->NormalDirection.getValue();

View File

@@ -104,7 +104,7 @@ void ViewProviderFemConstraintContact::updateData(const App::Property* prop)
float scaledheight = HEIGHT * pcConstraint->Scale.getValue();
float scaledwidth = WIDTH * pcConstraint->Scale.getValue();
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
if (points.size() != normals.size())

View File

@@ -144,7 +144,7 @@ void ViewProviderFemConstraintDisplacement::updateData(const App::Property* prop
}
#endif
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
if (points.size() != normals.size())

View File

@@ -124,7 +124,7 @@ void ViewProviderFemConstraintFixed::updateData(const App::Property* prop)
}
#endif
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
if (points.size() != normals.size())

View File

@@ -122,7 +122,7 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro
float scaledlength = ARROWLENGTH * pcConstraint->Scale.getValue();
std::string boundaryType = pcConstraint->BoundaryType.getValueAsString();
if (strcmp(prop->getName(), "BoundaryType") == 0) {
if (prop == &pcConstraint->BoundaryType) {
if (boundaryType == "wall")
FaceColor.setValue(0.0, 1.0, 1.0);
else if (boundaryType == "interface")
@@ -147,7 +147,7 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro
}
#endif
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
#ifdef USE_MULTIPLE_COPY
@@ -191,7 +191,8 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro
cp->matrix.finishEditing();
#endif
}
else if (strcmp(prop->getName(),"DirectionVector") == 0) { // Note: "Reversed" also triggers "DirectionVector"
else if (prop == &pcConstraint->DirectionVector) {
// Note: "Reversed" also triggers "DirectionVector"
// Re-orient all arrows
Base::Vector3d normal = pcConstraint->NormalDirection.getValue();
Base::Vector3d forceDirection = pcConstraint->DirectionVector.getValue();
@@ -247,7 +248,7 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro
}
#endif
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
if (points.size() != normals.size())

View File

@@ -126,7 +126,7 @@ void ViewProviderFemConstraintForce::updateData(const App::Property* prop)
}
#endif
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
#ifdef USE_MULTIPLE_COPY
@@ -171,7 +171,8 @@ void ViewProviderFemConstraintForce::updateData(const App::Property* prop)
cp->matrix.finishEditing();
#endif
}
else if (strcmp(prop->getName(),"DirectionVector") == 0) { // Note: "Reversed" also triggers "DirectionVector"
else if (prop == &pcConstraint->DirectionVector) {
// Note: "Reversed" also triggers "DirectionVector"
// Re-orient all arrows
Base::Vector3d normal = pcConstraint->NormalDirection.getValue();
Base::Vector3d forceDirection = pcConstraint->DirectionVector.getValue();

View File

@@ -110,7 +110,7 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
Fem::ConstraintGear* pcConstraint = static_cast<Fem::ConstraintGear*>(this->getObject());
// Gets called whenever a property of the attached object changes
if (strcmp(prop->getName(),"BasePoint") == 0) {
if (prop == &pcConstraint->BasePoint) {
if (pcConstraint->Height.getValue() > Precision::Confusion()) {
// Remove and recreate the symbol
Gui::coinRemoveAllChildren(pShapeSep);
@@ -136,7 +136,7 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
createPlacement(pShapeSep, SbVec3f(dia/2 * sin(angle), 0, dia/2 * cos(angle)), SbRotation(ax, dir));
pShapeSep->addChild(createArrow(dia/2, dia/8));
}
} else if (strcmp(prop->getName(),"Diameter") == 0) {
} else if (prop == &pcConstraint->Diameter) {
if (pShapeSep->getNumChildren() > 0) {
// Change the symbol
Base::Vector3d axis = pcConstraint->Axis.getValue();
@@ -158,7 +158,7 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
sep = static_cast<SoSeparator*>(pShapeSep->getChild(5));
updateArrow(sep, 0, dia/2, dia/8);
}
} else if ((strcmp(prop->getName(),"DirectionVector") == 0) || (strcmp(prop->getName(),"ForceAngle") == 0)) {
} else if ((prop == &pcConstraint->DirectionVector) || (prop == &pcConstraint->ForceAngle)) {
// Note: "Reversed" also triggers "DirectionVector"
if (pShapeSep->getNumChildren() > 0) {
// Re-orient the symbol

View File

@@ -105,7 +105,7 @@ void ViewProviderFemConstraintHeatflux::updateData(const App::Property* prop)
// //float facetemp = pcConstraint->FaceTemp.getValue();
//float filmcoef = pcConstraint->FilmCoef.getValue();
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
if (points.size() != normals.size())

View File

@@ -105,7 +105,7 @@ void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* pro
float scaledradius = RADIUS * pcConstraint->Scale.getValue(); //OvG: Calculate scaled values once only
float scaledheight = HEIGHT * pcConstraint->Scale.getValue();
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
if (points.size() != normals.size())

View File

@@ -110,7 +110,7 @@ void ViewProviderFemConstraintPressure::updateData(const App::Property* prop)
}
#endif
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
if (points.size() != normals.size()) {

View File

@@ -107,7 +107,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
// Gets called whenever a property of the attached object changes
Fem::ConstraintPulley* pcConstraint = static_cast<Fem::ConstraintPulley*>(this->getObject());
if (strcmp(prop->getName(), "BasePoint") == 0) {
if (prop == &pcConstraint->BasePoint) {
if (pcConstraint->Height.getValue() > Precision::Confusion()) {
// Remove and recreate the symbol
Gui::coinRemoveAllChildren(pShapeSep);
@@ -157,7 +157,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
pShapeSep->addChild(sep);// child 4
}
}
else if (strcmp(prop->getName(), "Diameter") == 0) {
else if (prop == &pcConstraint->Diameter) {
if (pShapeSep->getNumChildren() > 0) {
// Change the symbol
double radius = pcConstraint->Radius.getValue();
@@ -198,8 +198,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
updateArrow(subsep, 0, dia / 8 + dia / 2 * rat2, dia / 8);
}
}
else if ((strcmp(prop->getName(), "ForceAngle") == 0)
|| (strcmp(prop->getName(), "BeltAngle") == 0)) {
else if ((prop == &pcConstraint->ForceAngle) || (prop == &pcConstraint->BeltAngle)) {
if (pShapeSep->getNumChildren() > 0) {
double radius = pcConstraint->Radius.getValue();
double dia = pcConstraint->Diameter.getValue();
@@ -224,8 +223,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
-cos(forceAngle - beltAngle - M_PI_2))));
}
}
else if ((strcmp(prop->getName(), "BeltForce1") == 0)
|| (strcmp(prop->getName(), "BeltForce2") == 0)) {
else if ((prop == &pcConstraint->BeltForce1) || (prop == &pcConstraint->BeltForce2)) {
if (pShapeSep->getNumChildren() > 0) {
double radius = pcConstraint->Radius.getValue();
double dia = pcConstraint->Diameter.getValue();

View File

@@ -110,7 +110,7 @@ void ViewProviderFemConstraintSpring::updateData(const App::Property* prop)
}
#endif
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
if (points.size() != normals.size()) {

View File

@@ -104,7 +104,7 @@ void ViewProviderFemConstraintTemperature::updateData(const App::Property* prop)
float scaledheight = HEIGHT * pcConstraint->Scale.getValue();
//float temperature = pcConstraint->temperature.getValue();
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
if (points.size() != normals.size())

View File

@@ -110,7 +110,7 @@ void ViewProviderFemConstraintTransform::updateData(const App::Property* prop)
std::string transform_type = pcConstraint->TransformType.getValueAsString();
if (transform_type == "Rectangular") {
if (strcmp(prop->getName(),"Points") == 0) {
if (prop == &pcConstraint->Points) {
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
if (points.size() != normals.size())

View File

@@ -624,7 +624,8 @@ void ViewProviderFemPostObject::WriteTransparency()
void ViewProviderFemPostObject::updateData(const App::Property* p)
{
if (strcmp(p->getName(), "Data") == 0) {
Fem::FemPostObject* postObject = static_cast<Fem::FemPostObject*>(getObject());
if (p == &postObject->Data) {
updateVtk();
}
}

View File

@@ -72,8 +72,8 @@ std::vector< App::DocumentObject* > ViewProviderFemPostPipeline::claimChildren3D
void ViewProviderFemPostPipeline::updateData(const App::Property* prop) {
FemGui::ViewProviderFemPostObject::updateData(prop);
if (strcmp(prop->getName(), "Function") == 0)
Fem::FemPostPipeline* pipeline = static_cast<Fem::FemPostPipeline*>(getObject());
if (prop == &pipeline->Functions)
updateFunctionSize();
}