[FEM] post object: some whitespace and style fixes

all made by MSVC
This commit is contained in:
Uwe
2022-03-23 21:51:25 +01:00
parent 06622dfc85
commit 8d618d44c0
4 changed files with 240 additions and 253 deletions

View File

@@ -81,7 +81,7 @@ void FunctionWidget::setViewProvider(ViewProviderFemPostFunction* view) {
void FunctionWidget::onObjectsChanged(const App::DocumentObject& obj, const App::Property& p) {
if(&obj == m_object)
if (&obj == m_object)
onChange(p);
}
@@ -114,7 +114,7 @@ void ViewProviderFemPostFunctionProvider::onChanged(const App::Property* prop) {
void ViewProviderFemPostFunctionProvider::updateData(const App::Property* prop) {
Gui::ViewProviderDocumentObject::updateData(prop);
if(strcmp(prop->getName(), "Functions") == 0) {
if (strcmp(prop->getName(), "Functions") == 0) {
updateSize();
}
}
@@ -122,9 +122,9 @@ void ViewProviderFemPostFunctionProvider::updateData(const App::Property* prop)
void ViewProviderFemPostFunctionProvider::updateSize() {
std::vector< App::DocumentObject* > vec = claimChildren();
for(std::vector< App::DocumentObject* >::iterator it = vec.begin(); it != vec.end(); ++it) {
for (std::vector< App::DocumentObject* >::iterator it = vec.begin(); it != vec.end(); ++it) {
if(!(*it)->isDerivedFrom(Fem::FemPostFunction::getClassTypeId()))
if (!(*it)->isDerivedFrom(Fem::FemPostFunction::getClassTypeId()))
continue;
ViewProviderFemPostFunction* vp = static_cast<FemGui::ViewProviderFemPostFunction*>(Gui::Application::Instance->getViewProvider(*it));
@@ -154,7 +154,7 @@ ViewProviderFemPostFunction::ViewProviderFemPostFunction()
m_scale = new SoScale();
m_scale->ref();
m_scale->scaleFactor = SbVec3f(1,1,1);
m_scale->scaleFactor = SbVec3f(1, 1, 1);
}
ViewProviderFemPostFunction::~ViewProviderFemPostFunction()
@@ -165,13 +165,13 @@ ViewProviderFemPostFunction::~ViewProviderFemPostFunction()
//transform is unref'd when it is replaced by the dragger
}
void ViewProviderFemPostFunction::attach(App::DocumentObject *pcObj)
void ViewProviderFemPostFunction::attach(App::DocumentObject* pcObj)
{
ViewProviderDocumentObject::attach(pcObj);
// setup the graph for editing the function unit geometry
SoMaterial* color = new SoMaterial();
color->diffuseColor.setValue(0,0,1);
color->diffuseColor.setValue(0, 0, 1);
color->transparency.setValue(0.5);
m_transform = new SoTransform;
@@ -197,7 +197,7 @@ void ViewProviderFemPostFunction::attach(App::DocumentObject *pcObj)
sa.setSearchingAll(FALSE);
sa.setNode(m_transform);
sa.apply(pcEditNode);
SoPath * path = sa.getPath();
SoPath* path = sa.getPath();
if (path) {
m_manip->replaceNode(path);
@@ -231,7 +231,7 @@ std::vector<std::string> ViewProviderFemPostFunction::getDisplayModes(void) cons
return StrList;
}
void ViewProviderFemPostFunction::dragStartCallback(void *data, SoDragger *)
void ViewProviderFemPostFunction::dragStartCallback(void* data, SoDragger*)
{
// This is called when a manipulator is about to manipulating
Gui::Application::Instance->activeDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Edit Mirror"));
@@ -242,24 +242,24 @@ void ViewProviderFemPostFunction::dragStartCallback(void *data, SoDragger *)
that->m_autoRecompute = hGrp->GetBool("PostAutoRecompute", false);
}
void ViewProviderFemPostFunction::dragFinishCallback(void *data, SoDragger *)
void ViewProviderFemPostFunction::dragFinishCallback(void* data, SoDragger*)
{
// This is called when a manipulator has done manipulating
Gui::Application::Instance->activeDocument()->commitCommand();
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
if(that->m_autoRecompute)
if (that->m_autoRecompute)
that->getObject()->getDocument()->recompute();
reinterpret_cast<ViewProviderFemPostFunction*>(data)->m_isDragging = false;
}
void ViewProviderFemPostFunction::dragMotionCallback(void *data, SoDragger *drag)
void ViewProviderFemPostFunction::dragMotionCallback(void* data, SoDragger* drag)
{
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
that->draggerUpdate(drag);
if(that->m_autoRecompute)
if (that->m_autoRecompute)
that->getObject()->getDocument()->recompute();
}
@@ -267,10 +267,10 @@ void ViewProviderFemPostFunction::dragMotionCallback(void *data, SoDragger *drag
bool ViewProviderFemPostFunction::setEdit(int ModNum) {
if (ModNum == ViewProvider::Default || ModNum == 1 ) {
if (ModNum == ViewProvider::Default || ModNum == 1) {
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
TaskDlgPost *postDlg = qobject_cast<TaskDlgPost*>(dlg);
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
TaskDlgPost* postDlg = qobject_cast<TaskDlgPost*>(dlg);
if (postDlg && postDlg->getView() != this)
postDlg = nullptr; // another pad left open its task panel
if (dlg && !postDlg) {
@@ -317,7 +317,7 @@ void ViewProviderFemPostFunction::onChanged(const App::Property* prop) {
Gui::ViewProviderDocumentObject::onChanged(prop);
if(m_autoscale)
if (m_autoscale)
m_scale->scaleFactor = SbVec3f(AutoScaleFactorX.getValue(), AutoScaleFactorY.getValue(), AutoScaleFactorZ.getValue());
}
@@ -337,9 +337,9 @@ ViewProviderFemPostPlaneFunction::ViewProviderFemPostPlaneFunction() {
SoCoordinate3* points = new SoCoordinate3();
points->point.setNum(4);
points->point.set1Value(0, -0.5, -0.5, 0);
points->point.set1Value(1, -0.5, 0.5, 0);
points->point.set1Value(2, 0.5, 0.5, 0);
points->point.set1Value(3, 0.5, -0.5, 0);
points->point.set1Value(1, -0.5, 0.5, 0);
points->point.set1Value(2, 0.5, 0.5, 0);
points->point.set1Value(3, 0.5, -0.5, 0);
points->point.set1Value(4, -0.5, -0.5, 0);
SoLineSet* line = new SoLineSet();
getGeometryNode()->addChild(points);
@@ -359,28 +359,28 @@ void ViewProviderFemPostPlaneFunction::draggerUpdate(SoDragger* m) {
SbRotation rot, scaleDir;
const SbVec3f& center = dragger->center.getValue();
SbVec3f norm(0,0,1);
dragger->rotation.getValue().multVec(norm,norm);
SbVec3f norm(0, 0, 1);
dragger->rotation.getValue().multVec(norm, norm);
func->Origin.setValue(center[0], center[1], center[2]);
func->Normal.setValue(norm[0],norm[1],norm[2]);
func->Normal.setValue(norm[0], norm[1], norm[2]);
SbVec3f t = static_cast<SoCenterballManip*>(getManipulator())->translation.getValue();
SbVec3f rt, irt;
dragger->rotation.getValue().multVec(t,rt);
dragger->rotation.getValue().inverse().multVec(t,irt);
dragger->rotation.getValue().multVec(t, rt);
dragger->rotation.getValue().inverse().multVec(t, irt);
}
void ViewProviderFemPostPlaneFunction::updateData(const App::Property* p) {
Fem::FemPostPlaneFunction* func = static_cast<Fem::FemPostPlaneFunction*>(getObject());
if(!isDragging() && (p == &func->Origin || p == &func->Normal)) {
if (!isDragging() && (p == &func->Origin || p == &func->Normal)) {
Base::Vector3d trans = func->Origin.getValue();
Base::Vector3d norm = func->Normal.getValue();
norm = norm / norm.Length();
SbRotation rot(SbVec3f(0.,0.,1.), SbVec3f(norm.x, norm.y, norm.z));
SbRotation rot(SbVec3f(0., 0., 1.), SbVec3f(norm.x, norm.y, norm.z));
SbMatrix t, translate;
t.setRotate(rot);
@@ -429,13 +429,13 @@ void PlaneWidget::setViewProvider(ViewProviderFemPostFunction* view) {
void PlaneWidget::onChange(const App::Property& p) {
setBlockObjectUpdates(true);
if(strcmp(p.getName(), "Normal") == 0) {
if (strcmp(p.getName(), "Normal") == 0) {
const Base::Vector3d& vec = static_cast<const App::PropertyVector*>(&p)->getValue();
ui->normalX->setValue(vec.x);
ui->normalY->setValue(vec.y);
ui->normalZ->setValue(vec.z);
}
else if(strcmp(p.getName(), "Origin") == 0) {
else if (strcmp(p.getName(), "Origin") == 0) {
const Base::Vector3d& vec = static_cast<const App::PropertyVectorDistance*>(&p)->getValue();
ui->originX->setValue(vec.x);
ui->originY->setValue(vec.y);
@@ -446,15 +446,15 @@ void PlaneWidget::onChange(const App::Property& p) {
void PlaneWidget::normalChanged(double) {
if(!blockObjectUpdates()) {
if (!blockObjectUpdates()) {
Base::Vector3d vec(ui->normalX->value(), ui->normalY->value(), ui->normalZ->value());
static_cast<Fem::FemPostPlaneFunction*>(getObject())->Normal.setValue(vec);
}
}
}
void PlaneWidget::originChanged(double) {
if(!blockObjectUpdates()) {
if (!blockObjectUpdates()) {
Base::Vector3d vec(ui->originX->value(), ui->originY->value(), ui->originZ->value());
static_cast<Fem::FemPostPlaneFunction*>(getObject())->Origin.setValue(vec);
}
@@ -474,21 +474,21 @@ ViewProviderFemPostSphereFunction::ViewProviderFemPostSphereFunction() {
//setup the visualisation geometry
SoCoordinate3* points = new SoCoordinate3();
points->point.setNum(2*84);
points->point.setNum(2 * 84);
int idx = 0;
for(int i=0; i<4; i++) {
for(int j=0; j<21; j++) {
points->point.set1Value(idx, SbVec3f(std::sin(2*M_PI/20*j) * std::cos(M_PI/4*i),
std::sin(2*M_PI/20*j) * std::sin(M_PI/4*i),
std::cos(2*M_PI/20*j) ));
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 21; j++) {
points->point.set1Value(idx, SbVec3f(std::sin(2 * M_PI / 20 * j) * std::cos(M_PI / 4 * i),
std::sin(2 * M_PI / 20 * j) * std::sin(M_PI / 4 * i),
std::cos(2 * M_PI / 20 * j)));
++idx;
}
}
for(int i=0; i<4; i++) {
for(int j=0; j<21; j++) {
points->point.set1Value(idx, SbVec3f(std::sin(M_PI/4*i) * std::cos(2*M_PI/20*j),
std::sin(M_PI/4*i) * std::sin(2*M_PI/20*j),
std::cos(M_PI/4*i) ));
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 21; j++) {
points->point.set1Value(idx, SbVec3f(std::sin(M_PI / 4 * i) * std::cos(2 * M_PI / 20 * j),
std::sin(M_PI / 4 * i) * std::sin(2 * M_PI / 20 * j),
std::cos(M_PI / 4 * i)));
++idx;
}
}
@@ -529,7 +529,7 @@ void ViewProviderFemPostSphereFunction::draggerUpdate(SoDragger* m) {
SbRotation rot, scaleDir;
const SbVec3f& center = dragger->translation.getValue();
SbVec3f norm(0,0,1);
SbVec3f norm(0, 0, 1);
func->Center.setValue(center[0], center[1], center[2]);
func->Radius.setValue(dragger->scaleFactor.getValue()[0]);
}
@@ -538,7 +538,7 @@ void ViewProviderFemPostSphereFunction::updateData(const App::Property* p) {
Fem::FemPostSphereFunction* func = static_cast<Fem::FemPostSphereFunction*>(getObject());
if(!isDragging() && (p == &func->Center || p == &func->Radius)) {
if (!isDragging() && (p == &func->Center || p == &func->Radius)) {
Base::Vector3d trans = func->Center.getValue();
double radius = func->Radius.getValue();
@@ -548,7 +548,6 @@ void ViewProviderFemPostSphereFunction::updateData(const App::Property* p) {
translate.setTranslate(SbVec3f(trans.x, trans.y, trans.z));
t.multRight(translate);
getManipulator()->setMatrix(t);
}
Gui::ViewProviderDocumentObject::updateData(p);
}
@@ -588,11 +587,11 @@ void SphereWidget::setViewProvider(ViewProviderFemPostFunction* view) {
void SphereWidget::onChange(const App::Property& p) {
setBlockObjectUpdates(true);
if(strcmp(p.getName(), "Radius") == 0) {
if (strcmp(p.getName(), "Radius") == 0) {
double val = static_cast<const App::PropertyDistance*>(&p)->getValue();
ui->radius->setValue(val);
}
else if(strcmp(p.getName(), "Center") == 0) {
else if (strcmp(p.getName(), "Center") == 0) {
const Base::Vector3d& vec = static_cast<const App::PropertyVectorDistance*>(&p)->getValue();
ui->centerX->setValue(vec.x);
ui->centerY->setValue(vec.y);
@@ -603,15 +602,15 @@ void SphereWidget::onChange(const App::Property& p) {
void SphereWidget::centerChanged(double) {
if(!blockObjectUpdates()) {
if (!blockObjectUpdates()) {
Base::Vector3d vec(ui->centerX->value(), ui->centerY->value(), ui->centerZ->value());
static_cast<Fem::FemPostSphereFunction*>(getObject())->Center.setValue(vec);
}
}
}
void SphereWidget::radiusChanged(double) {
if(!blockObjectUpdates()) {
if (!blockObjectUpdates()) {
static_cast<Fem::FemPostSphereFunction*>(getObject())->Radius.setValue(ui->radius->value());
}
}