Fem: Apply clang-format
This commit is contained in:
@@ -24,22 +24,23 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <Inventor/SbRotation.h>
|
||||
# include <Inventor/SbVec3f.h>
|
||||
# include <Inventor/nodes/SoMultipleCopy.h>
|
||||
# include <Inventor/nodes/SoSeparator.h>
|
||||
#include <Inventor/SbRotation.h>
|
||||
#include <Inventor/SbVec3f.h>
|
||||
#include <Inventor/nodes/SoMultipleCopy.h>
|
||||
#include <Inventor/nodes/SoSeparator.h>
|
||||
#endif
|
||||
|
||||
#include <Gui/Control.h>
|
||||
#include "Mod/Fem/App/FemConstraintSpring.h"
|
||||
#include <Gui/Control.h>
|
||||
|
||||
#include "TaskFemConstraintSpring.h" //TODO do next
|
||||
#include "ViewProviderFemConstraintSpring.h"
|
||||
#include "TaskFemConstraintSpring.h" //TODO do next
|
||||
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
PROPERTY_SOURCE(FemGui::ViewProviderFemConstraintSpring, FemGui::ViewProviderFemConstraintOnBoundary)
|
||||
PROPERTY_SOURCE(FemGui::ViewProviderFemConstraintSpring,
|
||||
FemGui::ViewProviderFemConstraintOnBoundary)
|
||||
|
||||
ViewProviderFemConstraintSpring::ViewProviderFemConstraintSpring()
|
||||
{
|
||||
@@ -49,23 +50,25 @@ ViewProviderFemConstraintSpring::ViewProviderFemConstraintSpring()
|
||||
|
||||
ViewProviderFemConstraintSpring::~ViewProviderFemConstraintSpring() = default;
|
||||
|
||||
//FIXME setEdit needs a careful review
|
||||
// FIXME setEdit needs a careful review
|
||||
bool ViewProviderFemConstraintSpring::setEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// When double-clicking on the item for this constraint the
|
||||
// object unsets and sets its edit mode without closing
|
||||
// the task panel
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
TaskDlgFemConstraintSpring *constrDlg =
|
||||
qobject_cast<TaskDlgFemConstraintSpring *>(dlg);// check this out too
|
||||
if (constrDlg && constrDlg->getConstraintView() != this)
|
||||
constrDlg = nullptr; // another constraint left open its task panel
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
TaskDlgFemConstraintSpring* constrDlg =
|
||||
qobject_cast<TaskDlgFemConstraintSpring*>(dlg); // check this out too
|
||||
if (constrDlg && constrDlg->getConstraintView() != this) {
|
||||
constrDlg = nullptr; // another constraint left open its task panel
|
||||
}
|
||||
if (dlg && !constrDlg) {
|
||||
if (constraintDialog) {
|
||||
// Ignore the request to open another dialog
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
constraintDialog = new TaskFemConstraintSpring(this);
|
||||
return true;
|
||||
}
|
||||
@@ -75,35 +78,39 @@ bool ViewProviderFemConstraintSpring::setEdit(int ModNum)
|
||||
Gui::Selection().clearSelection();
|
||||
|
||||
// start the edit dialog
|
||||
if (constrDlg)
|
||||
if (constrDlg) {
|
||||
Gui::Control().showDialog(constrDlg);
|
||||
else
|
||||
}
|
||||
else {
|
||||
Gui::Control().showDialog(new TaskDlgFemConstraintSpring(this));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return ViewProviderDocumentObject::setEdit(ModNum); // clazy:exclude=skipped-base-method
|
||||
return ViewProviderDocumentObject::setEdit(ModNum); // clazy:exclude=skipped-base-method
|
||||
}
|
||||
}
|
||||
|
||||
#define WIDTH (1)
|
||||
#define LENGTH (2)
|
||||
//#define USE_MULTIPLE_COPY //OvG: MULTICOPY fails to update scaled arrows on initial drawing - so disable
|
||||
// #define USE_MULTIPLE_COPY //OvG: MULTICOPY fails to update scaled arrows on initial drawing - so
|
||||
// disable
|
||||
|
||||
void ViewProviderFemConstraintSpring::updateData(const App::Property* prop)
|
||||
{
|
||||
// Gets called whenever a property of the attached object changes
|
||||
Fem::ConstraintSpring *pcConstraint = static_cast<Fem::ConstraintSpring *>(this->getObject());
|
||||
float scaledwidth = WIDTH * pcConstraint->Scale.getValue(); //OvG: Calculate scaled values once only
|
||||
Fem::ConstraintSpring* pcConstraint = static_cast<Fem::ConstraintSpring*>(this->getObject());
|
||||
float scaledwidth =
|
||||
WIDTH * pcConstraint->Scale.getValue(); // OvG: Calculate scaled values once only
|
||||
float scaledlength = LENGTH * pcConstraint->Scale.getValue();
|
||||
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
//OvG: always need access to cp for scaling
|
||||
// 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*)createSpring(scaledlength, scaledwidth)); //OvG: Scaling
|
||||
cp->addChild((SoNode*)createSpring(scaledlength, scaledwidth)); // OvG: Scaling
|
||||
pShapeSep->addChild(cp);
|
||||
}
|
||||
#endif
|
||||
@@ -117,7 +124,7 @@ void ViewProviderFemConstraintSpring::updateData(const App::Property* prop)
|
||||
std::vector<Base::Vector3d>::const_iterator n = normals.begin();
|
||||
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
cp = static_cast<SoMultipleCopy*>(pShapeSep->getChild(0)); //OvG: Use top cp
|
||||
cp = static_cast<SoMultipleCopy*>(pShapeSep->getChild(0)); // OvG: Use top cp
|
||||
cp->matrix.setNum(points.size());
|
||||
SbMatrix* matrices = cp->matrix.startEditing();
|
||||
int idx = 0;
|
||||
@@ -126,19 +133,19 @@ void ViewProviderFemConstraintSpring::updateData(const App::Property* prop)
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
#endif
|
||||
|
||||
for (const auto & point : points) {
|
||||
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, 0), dir);
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
SbMatrix m;
|
||||
m.setTransform(base, rot, SbVec3f(1,1,1));
|
||||
m.setTransform(base, rot, SbVec3f(1, 1, 1));
|
||||
matrices[idx] = m;
|
||||
idx++;
|
||||
#else
|
||||
SoSeparator* sep = new SoSeparator();
|
||||
createPlacement(sep, base, rot);
|
||||
createSpring(sep, scaledlength , scaledwidth); //OvG: Scaling
|
||||
createSpring(sep, scaledlength, scaledwidth); // OvG: Scaling
|
||||
pShapeSep->addChild(sep);
|
||||
#endif
|
||||
n++;
|
||||
|
||||
Reference in New Issue
Block a user