[FEM] ViewProviderFemConstrain*: remove unused includes - part 2/2

- also sort includes
- also fix warnings about too long lines
This commit is contained in:
Uwe
2022-10-03 18:14:51 +02:00
parent 8522b9c813
commit c63ce3f10b
7 changed files with 196 additions and 204 deletions

View File

@@ -23,31 +23,22 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Standard_math.hxx>
# include <Precision.hxx>
# include <Inventor/nodes/SoSeparator.h>
# include <Inventor/nodes/SoTranslation.h>
# include <Inventor/nodes/SoRotation.h>
# include <Inventor/nodes/SoMultipleCopy.h>
# include <Inventor/nodes/SoCylinder.h>
# include <Inventor/nodes/SoSphere.h>
# include <Inventor/nodes/SoText3.h>
# include <Inventor/nodes/SoFont.h>
# include <Inventor/nodes/SoMaterial.h>
# include <Inventor/nodes/SoMaterialBinding.h>
# include <Inventor/nodes/SoScale.h>
# include <Inventor/nodes/SoRotation.h>
# include <Inventor/nodes/SoSeparator.h>
# include <Inventor/nodes/SoSphere.h>
# include <Inventor/nodes/SoTranslation.h>
#endif
#include "Mod/Fem/App/FemConstraintTemperature.h"
#include "TaskFemConstraintTemperature.h"
#include "ViewProviderFemConstraintTemperature.h"
#include <Base/Console.h>
#include <Gui/Control.h>
#include "Mod/Fem/App/FemConstraintTemperature.h"
#include "ViewProviderFemConstraintTemperature.h"
#include "TaskFemConstraintTemperature.h"
using namespace FemGui;
@@ -56,7 +47,7 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemConstraintTemperature, FemGui::ViewProvid
ViewProviderFemConstraintTemperature::ViewProviderFemConstraintTemperature()
{
sPixmap = "FEM_ConstraintTemperature";
ADD_PROPERTY(FaceColor,(0.2f,0.3f,0.2f));
ADD_PROPERTY(FaceColor, (0.2f, 0.3f, 0.2f));
}
ViewProviderFemConstraintTemperature::~ViewProviderFemConstraintTemperature()
@@ -71,7 +62,8 @@ bool ViewProviderFemConstraintTemperature::setEdit(int ModNum)
// object unsets and sets its edit mode without closing
// the task panel
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
TaskDlgFemConstraintTemperature *constrDlg = qobject_cast<TaskDlgFemConstraintTemperature *>(dlg);
TaskDlgFemConstraintTemperature *constrDlg =
qobject_cast<TaskDlgFemConstraintTemperature *>(dlg);
if (constrDlg && constrDlg->getConstraintView() != this)
constrDlg = nullptr; // another constraint left open its task panel
if (dlg && !constrDlg) {
@@ -106,7 +98,8 @@ bool ViewProviderFemConstraintTemperature::setEdit(int ModNum)
void ViewProviderFemConstraintTemperature::updateData(const App::Property* prop)
{
// Gets called whenever a property of the attached object changes
Fem::ConstraintTemperature* pcConstraint = static_cast<Fem::ConstraintTemperature*>(this->getObject());
Fem::ConstraintTemperature *pcConstraint =
static_cast<Fem::ConstraintTemperature *>(this->getObject());
float scaledradius = RADIUS * pcConstraint->Scale.getValue(); //OvG: Calculate scaled values once only
float scaledheight = HEIGHT * pcConstraint->Scale.getValue();
//float temperature = pcConstraint->temperature.getValue();
@@ -121,58 +114,59 @@ void ViewProviderFemConstraintTemperature::updateData(const App::Property* prop)
// Note: Points and Normals are always updated together
Gui::coinRemoveAllChildren(pShapeSep);
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end(); p++) {
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
p++) {
//Define base and normal directions
SbVec3f base(p->x, p->y, p->z);
SbVec3f dir(n->x, n->y, n->z);//normal
///Temperature indication
//define separator
SoSeparator* sep = new SoSeparator();
SoSeparator *sep = new SoSeparator();
///draw a temp gauge,with sphere and a cylinder
//first move to correct position
SoTranslation* trans = new SoTranslation();
SbVec3f newPos=base+scaledradius*dir*0.7f;
SoTranslation *trans = new SoTranslation();
SbVec3f newPos = base + scaledradius * dir * 0.7f;
trans->translation.setValue(newPos);
sep->addChild(trans);
//adjust orientation
SoRotation* rot = new SoRotation();
rot->rotation.setValue(SbRotation(SbVec3f(0,1,0),dir));
SoRotation *rot = new SoRotation();
rot->rotation.setValue(SbRotation(SbVec3f(0, 1, 0), dir));
sep->addChild(rot);
//define color of shape
SoMaterial* myMaterial = new SoMaterial;
myMaterial->diffuseColor.set1Value(0,SbColor(1,0,0));//RGB
SoMaterial *myMaterial = new SoMaterial;
myMaterial->diffuseColor.set1Value(0, SbColor(1, 0, 0)); //RGB
//myMaterial->diffuseColor.set1Value(1,SbColor(.1,.1,.1));//possible to adjust sides separately
sep->addChild(myMaterial);
//draw a sphere
SoSphere* sph = new SoSphere();
sph->radius.setValue(scaledradius*0.75);
SoSphere *sph = new SoSphere();
sph->radius.setValue(scaledradius * 0.75);
sep->addChild(sph);
//translate position
SoTranslation* trans2 = new SoTranslation();
trans2->translation.setValue(SbVec3f(0,scaledheight*0.375,0));
SoTranslation *trans2 = new SoTranslation();
trans2->translation.setValue(SbVec3f(0, scaledheight * 0.375, 0));
sep->addChild(trans2);
//draw a cylinder
SoCylinder* cyl = new SoCylinder();
cyl->height.setValue(scaledheight*0.5);
cyl->radius.setValue(scaledradius*0.375);
SoCylinder *cyl = new SoCylinder();
cyl->height.setValue(scaledheight * 0.5);
cyl->radius.setValue(scaledradius * 0.375);
sep->addChild(cyl);
//translate position
SoTranslation* trans3 = new SoTranslation();
trans3->translation.setValue(SbVec3f(0,scaledheight*0.375,0));
SoTranslation *trans3 = new SoTranslation();
trans3->translation.setValue(SbVec3f(0, scaledheight * 0.375, 0));
sep->addChild(trans3);
//define color of shape
SoMaterial *myMaterial2 = new SoMaterial;
myMaterial2->diffuseColor.set1Value(0,SbColor(1,1,1));//RGB
myMaterial2->diffuseColor.set1Value(0, SbColor(1, 1, 1)); //RGB
sep->addChild(myMaterial2);
//draw a cylinder
SoCylinder* cyl2 = new SoCylinder();
cyl2->height.setValue(scaledheight*0.25);
cyl2->radius.setValue(scaledradius*0.375);
SoCylinder *cyl2 = new SoCylinder();
cyl2->height.setValue(scaledheight * 0.25);
cyl2->radius.setValue(scaledradius * 0.375);
sep->addChild(cyl2);
pShapeSep->addChild(sep);