Fem: Constraint symbol scaling (#13274)
* Fem: Constraint symbols rescaling * Fem: Add constraint symbol .iv files * Fem: Fix contact constraint symbol rescaling * Fem: Fix displacement constraint symbol rescaling * Fem: Fix fixed constraint symbol rescaling * Fem: Fix force constraint symbol rescaling * Fem: Fix heat flux constraint symbol rescaling * Fem: Fix plane rotation constraint symbol rescaling * Fem: Fix pressure constraint symbol rescaling * Fem: Fix spring constraint symbol rescaling * Fem: Fix temperature constraint symbol rescaling * Fem: Add tie constraint symbol
This commit is contained in:
@@ -46,6 +46,7 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemConstraintFixed, FemGui::ViewProviderFemC
|
||||
ViewProviderFemConstraintFixed::ViewProviderFemConstraintFixed()
|
||||
{
|
||||
sPixmap = "FEM_ConstraintFixed";
|
||||
loadSymbol((resourceSymbolDir + "ConstraintFixed.iv").c_str());
|
||||
}
|
||||
|
||||
ViewProviderFemConstraintFixed::~ViewProviderFemConstraintFixed() = default;
|
||||
@@ -108,69 +109,7 @@ bool ViewProviderFemConstraintFixed::setEdit(int ModNum)
|
||||
}
|
||||
}
|
||||
|
||||
#define WIDTH (2)
|
||||
#define HEIGHT (1)
|
||||
// #define USE_MULTIPLE_COPY //OvG: MULTICOPY fails to update scaled display on initial drawing -
|
||||
// so disable
|
||||
|
||||
void ViewProviderFemConstraintFixed::updateData(const App::Property* prop)
|
||||
{
|
||||
// Gets called whenever a property of the attached object changes
|
||||
Fem::ConstraintFixed* pcConstraint = static_cast<Fem::ConstraintFixed*>(this->getObject());
|
||||
float scaledwidth =
|
||||
WIDTH * pcConstraint->Scale.getValue(); // OvG: Calculate scaled values once only
|
||||
float scaledheight = HEIGHT * pcConstraint->Scale.getValue();
|
||||
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
// OvG: always need access to cp for scaling
|
||||
SoMultipleCopy* cp = new SoMultipleCopy();
|
||||
if (pShapeSep->getNumChildren() == 0) {
|
||||
// Set up the nodes
|
||||
cp->matrix.setNum(0);
|
||||
cp->addChild((SoNode*)createFixed(scaledheight, scaledwidth)); // OvG: Scaling
|
||||
pShapeSep->addChild(cp);
|
||||
}
|
||||
#endif
|
||||
|
||||
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()) {
|
||||
return;
|
||||
}
|
||||
std::vector<Base::Vector3d>::const_iterator n = normals.begin();
|
||||
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
cp = static_cast<SoMultipleCopy*>(pShapeSep->getChild(0));
|
||||
cp->matrix.setNum(points.size());
|
||||
SbMatrix* matrices = cp->matrix.startEditing();
|
||||
int idx = 0;
|
||||
#else
|
||||
// Note: Points and Normals are always updated together
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
#endif
|
||||
|
||||
for (const auto& point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dir(n->x, n->y, n->z);
|
||||
SbRotation rot(SbVec3f(0, -1, 0), dir);
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
SbMatrix m;
|
||||
m.setTransform(base, rot, SbVec3f(1, 1, 1));
|
||||
matrices[idx] = m;
|
||||
idx++;
|
||||
#else
|
||||
SoSeparator* sep = new SoSeparator();
|
||||
createPlacement(sep, base, rot);
|
||||
createFixed(sep, scaledheight, scaledwidth); // OvG: Scaling
|
||||
pShapeSep->addChild(sep);
|
||||
#endif
|
||||
n++;
|
||||
}
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
cp->matrix.finishEditing();
|
||||
#endif
|
||||
}
|
||||
|
||||
ViewProviderFemConstraint::updateData(prop);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user