[FEM] ViewProviderFemConstrain*: remove unused includes - part 2/2
- also sort includes - also fix warnings about too long lines
This commit is contained in:
@@ -23,30 +23,14 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#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>
|
||||
#endif
|
||||
|
||||
#include "Mod/Fem/App/FemConstraintInitialTemperature.h"
|
||||
#include "TaskFemConstraintInitialTemperature.h"
|
||||
#include "ViewProviderFemConstraintInitialTemperature.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/Control.h>
|
||||
#include "Mod/Fem/App/FemConstraintInitialTemperature.h"
|
||||
|
||||
#include "ViewProviderFemConstraintInitialTemperature.h"
|
||||
#include "TaskFemConstraintInitialTemperature.h"
|
||||
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
@@ -55,7 +39,7 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemConstraintInitialTemperature, FemGui::Vie
|
||||
ViewProviderFemConstraintInitialTemperature::ViewProviderFemConstraintInitialTemperature()
|
||||
{
|
||||
sPixmap = "FEM_ConstraintInitialTemperature";
|
||||
ADD_PROPERTY(FaceColor,(0.2f,0.3f,0.2f));
|
||||
ADD_PROPERTY(FaceColor, (0.2f, 0.3f, 0.2f));
|
||||
}
|
||||
|
||||
ViewProviderFemConstraintInitialTemperature::~ViewProviderFemConstraintInitialTemperature()
|
||||
@@ -70,7 +54,8 @@ bool ViewProviderFemConstraintInitialTemperature::setEdit(int ModNum)
|
||||
// object unsets and sets its edit mode without closing
|
||||
// the task panel
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
TaskDlgFemConstraintInitialTemperature *constrDlg = qobject_cast<TaskDlgFemConstraintInitialTemperature *>(dlg);
|
||||
TaskDlgFemConstraintInitialTemperature *constrDlg =
|
||||
qobject_cast<TaskDlgFemConstraintInitialTemperature *>(dlg);
|
||||
if (constrDlg && constrDlg->getConstraintView() != this)
|
||||
constrDlg = nullptr; // another constraint left open its task panel
|
||||
if (dlg && !constrDlg) {
|
||||
|
||||
@@ -21,22 +21,16 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <Standard_math.hxx>
|
||||
# include <Precision.hxx>
|
||||
#endif
|
||||
|
||||
#include "Mod/Fem/App/FemConstraint.h"
|
||||
#include "TaskFemConstraintOnBoundary.h"
|
||||
#include "ViewProviderFemConstraintOnBoundary.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Mod/Part/Gui/ViewProvider.h>
|
||||
#include "Mod/Fem/App/FemConstraint.h"
|
||||
#include <Mod/Part/Gui/ReferenceHighlighter.h>
|
||||
#include <Mod/Part/Gui/ViewProvider.h>
|
||||
|
||||
#include "ViewProviderFemConstraintOnBoundary.h"
|
||||
#include "TaskFemConstraintOnBoundary.h"
|
||||
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
@@ -75,7 +69,8 @@ void ViewProviderFemConstraintOnBoundary::highlightReferences(const bool on)
|
||||
|
||||
// go through the subelements with constraint and recolor them
|
||||
// TODO: Replace `ShapeColor` with anything more appropriate
|
||||
PartGui::ReferenceHighlighter highlighter(base->Shape.getValue(), colors.empty()?ShapeColor.getValue():colors[0]);
|
||||
PartGui::ReferenceHighlighter highlighter(
|
||||
base->Shape.getValue(), colors.empty() ? ShapeColor.getValue() : colors[0]);
|
||||
highlighter.getVertexColors(subSet.second, colors);
|
||||
vp->PointColorArray.setValues(colors);
|
||||
}
|
||||
@@ -87,7 +82,8 @@ void ViewProviderFemConstraintOnBoundary::highlightReferences(const bool on)
|
||||
|
||||
// go through the subelements with constraint and recolor them
|
||||
// TODO: Replace `ShapeColor` with anything more appropriate
|
||||
PartGui::ReferenceHighlighter highlighter(base->Shape.getValue(), colors.empty()?ShapeColor.getValue():colors[0]);
|
||||
PartGui::ReferenceHighlighter highlighter(
|
||||
base->Shape.getValue(), colors.empty() ? ShapeColor.getValue() : colors[0]);
|
||||
highlighter.getEdgeColors(subSet.second, colors);
|
||||
vp->LineColorArray.setValues(colors);
|
||||
}
|
||||
@@ -99,7 +95,8 @@ void ViewProviderFemConstraintOnBoundary::highlightReferences(const bool on)
|
||||
|
||||
// go through the subelements with constraint and recolor them
|
||||
// TODO: Replace `FaceColor` with anything more appropriate
|
||||
PartGui::ReferenceHighlighter highlighter(base->Shape.getValue(), colors.empty()?FaceColor.getValue():colors[0]);
|
||||
PartGui::ReferenceHighlighter highlighter(
|
||||
base->Shape.getValue(), colors.empty() ? FaceColor.getValue() : colors[0]);
|
||||
highlighter.getFaceColors(subSet.second, colors);
|
||||
vp->DiffuseColor.setValues(colors);
|
||||
}
|
||||
|
||||
@@ -23,31 +23,23 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#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/FemConstraintPlaneRotation.h"
|
||||
#include "TaskFemConstraintPlaneRotation.h"
|
||||
#include "ViewProviderFemConstraintPlaneRotation.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/Control.h>
|
||||
#include "Mod/Fem/App/FemConstraintPlaneRotation.h"
|
||||
|
||||
#include "ViewProviderFemConstraintPlaneRotation.h"
|
||||
#include "TaskFemConstraintPlaneRotation.h"
|
||||
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
@@ -57,7 +49,7 @@ ViewProviderFemConstraintPlaneRotation::ViewProviderFemConstraintPlaneRotation()
|
||||
{
|
||||
sPixmap = "FEM_ConstraintPlaneRotation";
|
||||
//Note change "planerotation" in line above to new constraint name, make sure it is the same as in taskFem* cpp file
|
||||
ADD_PROPERTY(FaceColor,(0.2f,0.3f,0.2f));
|
||||
ADD_PROPERTY(FaceColor, (0.2f, 0.3f, 0.2f));
|
||||
}
|
||||
|
||||
ViewProviderFemConstraintPlaneRotation::~ViewProviderFemConstraintPlaneRotation()
|
||||
@@ -72,7 +64,8 @@ bool ViewProviderFemConstraintPlaneRotation::setEdit(int ModNum)
|
||||
// object unsets and sets its edit mode without closing
|
||||
// the task panel
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
TaskDlgFemConstraintPlaneRotation *constrDlg = qobject_cast<TaskDlgFemConstraintPlaneRotation *>(dlg);
|
||||
TaskDlgFemConstraintPlaneRotation *constrDlg =
|
||||
qobject_cast<TaskDlgFemConstraintPlaneRotation *>(dlg);
|
||||
if (constrDlg && constrDlg->getConstraintView() != this)
|
||||
constrDlg = nullptr; // another constraint left open its task panel
|
||||
if (dlg && !constrDlg) {
|
||||
@@ -107,7 +100,8 @@ bool ViewProviderFemConstraintPlaneRotation::setEdit(int ModNum)
|
||||
void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* prop)
|
||||
{
|
||||
// Gets called whenever a property of the attached object changes
|
||||
Fem::ConstraintPlaneRotation* pcConstraint = static_cast<Fem::ConstraintPlaneRotation*>(this->getObject());
|
||||
Fem::ConstraintPlaneRotation *pcConstraint =
|
||||
static_cast<Fem::ConstraintPlaneRotation *>(this->getObject());
|
||||
float scaledradius = RADIUS * pcConstraint->Scale.getValue(); //OvG: Calculate scaled values once only
|
||||
float scaledheight = HEIGHT * pcConstraint->Scale.getValue();
|
||||
|
||||
@@ -121,7 +115,8 @@ void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* pro
|
||||
// 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
|
||||
@@ -139,19 +134,19 @@ void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* pro
|
||||
|
||||
///draw a temp gauge,with sphere and a cylinder
|
||||
//first move to correct position
|
||||
SoTranslation* trans = new SoTranslation();
|
||||
SbVec3f newPos=base+scaledradius*dir*0.08f;
|
||||
SoTranslation *trans = new SoTranslation();
|
||||
SbVec3f newPos = base + scaledradius * dir * 0.08f;
|
||||
trans->translation.setValue(newPos);
|
||||
sep->addChild(trans);
|
||||
|
||||
//adjust orientation
|
||||
SoRotation* rot = new SoRotation();
|
||||
rot->rotation.setValue(SbRotation(SbVec3f(1,0,0),dir));
|
||||
SoRotation *rot = new SoRotation();
|
||||
rot->rotation.setValue(SbRotation(SbVec3f(1, 0, 0), dir));
|
||||
sep->addChild(rot);
|
||||
|
||||
//define color of shape
|
||||
SoMaterial* myMaterial = new SoMaterial;
|
||||
myMaterial->diffuseColor.set1Value(0,SbColor(0,1,0));//RGB
|
||||
SoMaterial *myMaterial = new SoMaterial;
|
||||
myMaterial->diffuseColor.set1Value(0, SbColor(0, 1, 0)); //RGB
|
||||
//myMaterial->diffuseColor.set1Value(1,SbColor(0,0,1));//possible to adjust sides separately
|
||||
sep->addChild(myMaterial);
|
||||
|
||||
@@ -164,9 +159,9 @@ void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* pro
|
||||
//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();
|
||||
@@ -174,7 +169,7 @@ void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* pro
|
||||
//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();
|
||||
|
||||
@@ -21,24 +21,21 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#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/SbRotation.h>
|
||||
# include <Inventor/SbVec3f.h>
|
||||
# include <Inventor/nodes/SoMultipleCopy.h>
|
||||
# include <Inventor/nodes/SoSeparator.h>
|
||||
#endif
|
||||
|
||||
#include "Mod/Fem/App/FemConstraintPressure.h"
|
||||
#include "TaskFemConstraintPressure.h"
|
||||
#include "ViewProviderFemConstraintPressure.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/Control.h>
|
||||
#include "Mod/Fem/App/FemConstraintPressure.h"
|
||||
|
||||
#include "ViewProviderFemConstraintPressure.h"
|
||||
#include "TaskFemConstraintPressure.h"
|
||||
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
@@ -47,7 +44,7 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemConstraintPressure, FemGui::ViewProviderF
|
||||
ViewProviderFemConstraintPressure::ViewProviderFemConstraintPressure()
|
||||
{
|
||||
sPixmap = "FEM_ConstraintPressure";
|
||||
ADD_PROPERTY(FaceColor,(0.0f,0.2f,0.8f));
|
||||
ADD_PROPERTY(FaceColor, (0.0f, 0.2f, 0.8f));
|
||||
}
|
||||
|
||||
ViewProviderFemConstraintPressure::~ViewProviderFemConstraintPressure()
|
||||
@@ -97,7 +94,8 @@ bool ViewProviderFemConstraintPressure::setEdit(int ModNum)
|
||||
void ViewProviderFemConstraintPressure::updateData(const App::Property* prop)
|
||||
{
|
||||
// Gets called whenever a property of the attached object changes
|
||||
Fem::ConstraintPressure* pcConstraint = static_cast<Fem::ConstraintPressure*>(this->getObject());
|
||||
Fem::ConstraintPressure *pcConstraint =
|
||||
static_cast<Fem::ConstraintPressure *>(this->getObject());
|
||||
float scaledheadradius = ARROWHEADRADIUS * pcConstraint->Scale.getValue(); //OvG: Calculate scaled values once only
|
||||
float scaledlength = ARROWLENGTH * pcConstraint->Scale.getValue();
|
||||
|
||||
@@ -143,7 +141,7 @@ void ViewProviderFemConstraintPressure::updateData(const App::Property* prop)
|
||||
SbRotation rot(SbVec3f(0, rev, 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
|
||||
|
||||
@@ -21,26 +21,21 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#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 <QMessageBox>
|
||||
# include <Precision.hxx>
|
||||
# include <Inventor/SbRotation.h>
|
||||
# include <Inventor/SbVec3f.h>
|
||||
# include <Inventor/nodes/SoSeparator.h>
|
||||
#endif
|
||||
|
||||
#include "ViewProviderFemConstraintPulley.h"
|
||||
#include <Mod/Fem/App/FemConstraintPulley.h>
|
||||
#include "TaskFemConstraintPulley.h"
|
||||
#include "Gui/Control.h"
|
||||
#include <Mod/Fem/App/FemConstraintPulley.h>
|
||||
#include "ViewProviderFemConstraintPulley.h"
|
||||
#include "TaskFemConstraintPulley.h"
|
||||
|
||||
#include <Base/Console.h>
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
@@ -112,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 (strcmp(prop->getName(), "BasePoint") == 0) {
|
||||
if (pcConstraint->Height.getValue() > Precision::Confusion()) {
|
||||
// Remove and recreate the symbol
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
@@ -129,30 +124,40 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
double rat1 = 0.8, rat2 = 0.2;
|
||||
double f1 = pcConstraint->BeltForce1.getValue();
|
||||
double f2 = pcConstraint->BeltForce2.getValue();
|
||||
if (f1+f2 > Precision::Confusion()) {
|
||||
rat1 = f1 / (f1+f2);
|
||||
rat2 = f2 / (f1+f2);
|
||||
if (f1 + f2 > Precision::Confusion()) {
|
||||
rat1 = f1 / (f1 + f2);
|
||||
rat2 = f2 / (f1 + f2);
|
||||
}
|
||||
|
||||
SbVec3f b(base.x, base.y, base.z);
|
||||
SbVec3f ax(axis.x, axis.y, axis.z);
|
||||
|
||||
createPlacement(pShapeSep, b, SbRotation(SbVec3f(0,1,0), ax)); // child 0 and 1
|
||||
pShapeSep->addChild(createCylinder(pcConstraint->Height.getValue() * 0.8, dia/2)); // child 2
|
||||
SoSeparator* sep = new SoSeparator();
|
||||
createPlacement(sep, SbVec3f(dia/2 * sin(forceAngle+beltAngle), 0, dia/2 * cos(forceAngle+beltAngle)),
|
||||
SbRotation(SbVec3f(0,1,0), SbVec3f(sin(forceAngle+beltAngle+M_PI_2),0,cos(forceAngle+beltAngle+M_PI_2))));
|
||||
createPlacement(sep, SbVec3f(0, dia/8 + dia/2 * rat1, 0), SbRotation());
|
||||
sep->addChild(createArrow(dia/8 + dia/2 * rat1, dia/8));
|
||||
pShapeSep->addChild(sep); // child 3
|
||||
createPlacement(pShapeSep, b, SbRotation(SbVec3f(0, 1, 0), ax));// child 0 and 1
|
||||
pShapeSep->addChild(
|
||||
createCylinder(pcConstraint->Height.getValue() * 0.8, dia / 2));// child 2
|
||||
SoSeparator *sep = new SoSeparator();
|
||||
createPlacement(sep,
|
||||
SbVec3f(dia / 2 * sin(forceAngle + beltAngle), 0,
|
||||
dia / 2 * cos(forceAngle + beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(sin(forceAngle + beltAngle + M_PI_2), 0,
|
||||
cos(forceAngle + beltAngle + M_PI_2))));
|
||||
createPlacement(sep, SbVec3f(0, dia / 8 + dia / 2 * rat1, 0), SbRotation());
|
||||
sep->addChild(createArrow(dia / 8 + dia / 2 * rat1, dia / 8));
|
||||
pShapeSep->addChild(sep);// child 3
|
||||
sep = new SoSeparator();
|
||||
createPlacement(sep, SbVec3f(-dia/2 * sin(forceAngle-beltAngle), 0, -dia/2 * cos(forceAngle-beltAngle)),
|
||||
SbRotation(SbVec3f(0,1,0), SbVec3f(-sin(forceAngle-beltAngle-M_PI_2),0,-cos(forceAngle-beltAngle-M_PI_2))));
|
||||
createPlacement(sep, SbVec3f(0, dia/8 + dia/2 * rat2, 0), SbRotation());
|
||||
sep->addChild(createArrow(dia/8 + dia/2 * rat2, dia/8));
|
||||
pShapeSep->addChild(sep); // child 4
|
||||
createPlacement(sep,
|
||||
SbVec3f(-dia / 2 * sin(forceAngle - beltAngle), 0,
|
||||
-dia / 2 * cos(forceAngle - beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - M_PI_2), 0,
|
||||
-cos(forceAngle - beltAngle - M_PI_2))));
|
||||
createPlacement(sep, SbVec3f(0, dia / 8 + dia / 2 * rat2, 0), SbRotation());
|
||||
sep->addChild(createArrow(dia / 8 + dia / 2 * rat2, dia / 8));
|
||||
pShapeSep->addChild(sep);// child 4
|
||||
}
|
||||
} else if (strcmp(prop->getName(),"Diameter") == 0) {
|
||||
}
|
||||
else if (strcmp(prop->getName(), "Diameter") == 0) {
|
||||
if (pShapeSep->getNumChildren() > 0) {
|
||||
// Change the symbol
|
||||
double radius = pcConstraint->Radius.getValue();
|
||||
@@ -164,27 +169,37 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
double rat1 = 0.8, rat2 = 0.2;
|
||||
double f1 = pcConstraint->BeltForce1.getValue();
|
||||
double f2 = pcConstraint->BeltForce2.getValue();
|
||||
if (f1+f2 > Precision::Confusion()) {
|
||||
rat1 = f1 / (f1+f2);
|
||||
rat2 = f2 / (f1+f2);
|
||||
if (f1 + f2 > Precision::Confusion()) {
|
||||
rat1 = f1 / (f1 + f2);
|
||||
rat2 = f2 / (f1 + f2);
|
||||
}
|
||||
|
||||
const SoSeparator* sep = static_cast<SoSeparator*>(pShapeSep->getChild(2));
|
||||
updateCylinder(sep, 0, pcConstraint->Height.getValue() * 0.8, dia/2);
|
||||
sep = static_cast<SoSeparator*>(pShapeSep->getChild(3));
|
||||
updatePlacement(sep, 0, SbVec3f(dia/2 * sin(forceAngle+beltAngle), 0, dia/2 * cos(forceAngle+beltAngle)),
|
||||
SbRotation(SbVec3f(0,1,0), SbVec3f(sin(forceAngle+beltAngle+M_PI_2),0,cos(forceAngle+beltAngle+M_PI_2))));
|
||||
updatePlacement(sep, 2, SbVec3f(0, dia/8 + dia/2 * rat1, 0), SbRotation());
|
||||
const SoSeparator* subsep = static_cast<SoSeparator*>(sep->getChild(4));
|
||||
updateArrow(subsep, 0, dia/8 + dia/2 * rat1, dia/8);
|
||||
sep = static_cast<SoSeparator*>(pShapeSep->getChild(4));
|
||||
updatePlacement(sep, 0, SbVec3f(-dia/2 * sin(forceAngle-beltAngle), 0, -dia/2 * cos(forceAngle-beltAngle)),
|
||||
SbRotation(SbVec3f(0,1,0), SbVec3f(-sin(forceAngle-beltAngle-M_PI_2),0,-cos(forceAngle-beltAngle-M_PI_2))));
|
||||
updatePlacement(sep, 2, SbVec3f(0, dia/8 + dia/2 * rat2, 0), SbRotation());
|
||||
subsep = static_cast<SoSeparator*>(sep->getChild(4));
|
||||
updateArrow(subsep, 0, dia/8 + dia/2 * rat2, dia/8);
|
||||
const SoSeparator *sep = static_cast<SoSeparator *>(pShapeSep->getChild(2));
|
||||
updateCylinder(sep, 0, pcConstraint->Height.getValue() * 0.8, dia / 2);
|
||||
sep = static_cast<SoSeparator *>(pShapeSep->getChild(3));
|
||||
updatePlacement(sep, 0,
|
||||
SbVec3f(dia / 2 * sin(forceAngle + beltAngle), 0,
|
||||
dia / 2 * cos(forceAngle + beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(sin(forceAngle + beltAngle + M_PI_2), 0,
|
||||
cos(forceAngle + beltAngle + M_PI_2))));
|
||||
updatePlacement(sep, 2, SbVec3f(0, dia / 8 + dia / 2 * rat1, 0), SbRotation());
|
||||
const SoSeparator *subsep = static_cast<SoSeparator *>(sep->getChild(4));
|
||||
updateArrow(subsep, 0, dia / 8 + dia / 2 * rat1, dia / 8);
|
||||
sep = static_cast<SoSeparator *>(pShapeSep->getChild(4));
|
||||
updatePlacement(sep, 0,
|
||||
SbVec3f(-dia / 2 * sin(forceAngle - beltAngle), 0,
|
||||
-dia / 2 * cos(forceAngle - beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - M_PI_2), 0,
|
||||
-cos(forceAngle - beltAngle - M_PI_2))));
|
||||
updatePlacement(sep, 2, SbVec3f(0, dia / 8 + dia / 2 * rat2, 0), SbRotation());
|
||||
subsep = static_cast<SoSeparator *>(sep->getChild(4));
|
||||
updateArrow(subsep, 0, dia / 8 + dia / 2 * rat2, dia / 8);
|
||||
}
|
||||
} else if ((strcmp(prop->getName(), "ForceAngle") == 0) || (strcmp(prop->getName(), "BeltAngle") == 0)) {
|
||||
}
|
||||
else if ((strcmp(prop->getName(), "ForceAngle") == 0)
|
||||
|| (strcmp(prop->getName(), "BeltAngle") == 0)) {
|
||||
if (pShapeSep->getNumChildren() > 0) {
|
||||
double radius = pcConstraint->Radius.getValue();
|
||||
double dia = pcConstraint->Diameter.getValue();
|
||||
@@ -193,14 +208,24 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
|
||||
double beltAngle = pcConstraint->BeltAngle.getValue();
|
||||
|
||||
const SoSeparator* sep = static_cast<SoSeparator*>(pShapeSep->getChild(3));
|
||||
updatePlacement(sep, 0, SbVec3f(dia/2 * sin(forceAngle+beltAngle), 0, dia/2 * cos(forceAngle+beltAngle)),
|
||||
SbRotation(SbVec3f(0,1,0), SbVec3f(sin(forceAngle+beltAngle+M_PI_2),0,cos(forceAngle+beltAngle+M_PI_2))));
|
||||
sep = static_cast<SoSeparator*>(pShapeSep->getChild(4));
|
||||
updatePlacement(sep, 0, SbVec3f(-dia/2 * sin(forceAngle-beltAngle), 0, -dia/2 * cos(forceAngle-beltAngle)),
|
||||
SbRotation(SbVec3f(0,1,0), SbVec3f(-sin(forceAngle-beltAngle-M_PI_2),0,-cos(forceAngle-beltAngle-M_PI_2))));
|
||||
const SoSeparator *sep = static_cast<SoSeparator *>(pShapeSep->getChild(3));
|
||||
updatePlacement(sep, 0,
|
||||
SbVec3f(dia / 2 * sin(forceAngle + beltAngle), 0,
|
||||
dia / 2 * cos(forceAngle + beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(sin(forceAngle + beltAngle + M_PI_2), 0,
|
||||
cos(forceAngle + beltAngle + M_PI_2))));
|
||||
sep = static_cast<SoSeparator *>(pShapeSep->getChild(4));
|
||||
updatePlacement(sep, 0,
|
||||
SbVec3f(-dia / 2 * sin(forceAngle - beltAngle), 0,
|
||||
-dia / 2 * cos(forceAngle - beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - M_PI_2), 0,
|
||||
-cos(forceAngle - beltAngle - M_PI_2))));
|
||||
}
|
||||
} else if ((strcmp(prop->getName(), "BeltForce1") == 0) || (strcmp(prop->getName(), "BeltForce2") == 0)) {
|
||||
}
|
||||
else if ((strcmp(prop->getName(), "BeltForce1") == 0)
|
||||
|| (strcmp(prop->getName(), "BeltForce2") == 0)) {
|
||||
if (pShapeSep->getNumChildren() > 0) {
|
||||
double radius = pcConstraint->Radius.getValue();
|
||||
double dia = pcConstraint->Diameter.getValue();
|
||||
@@ -209,19 +234,19 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
double rat1 = 0.8, rat2 = 0.2;
|
||||
double f1 = pcConstraint->BeltForce1.getValue();
|
||||
double f2 = pcConstraint->BeltForce2.getValue();
|
||||
if (f1+f2 > Precision::Confusion()) {
|
||||
rat1 = f1 / (f1+f2);
|
||||
rat2 = f2 / (f1+f2);
|
||||
if (f1 + f2 > Precision::Confusion()) {
|
||||
rat1 = f1 / (f1 + f2);
|
||||
rat2 = f2 / (f1 + f2);
|
||||
}
|
||||
|
||||
const SoSeparator* sep = static_cast<SoSeparator*>(pShapeSep->getChild(3));
|
||||
updatePlacement(sep, 2, SbVec3f(0, dia/8 + dia/2 * rat1, 0), SbRotation());
|
||||
const SoSeparator* subsep = static_cast<SoSeparator*>(sep->getChild(4));
|
||||
updateArrow(subsep, 0, dia/8 + dia/2 * rat1, dia/8);
|
||||
sep = static_cast<SoSeparator*>(pShapeSep->getChild(4));
|
||||
updatePlacement(sep, 2, SbVec3f(0, dia/8 + dia/2 * rat2, 0), SbRotation());
|
||||
subsep = static_cast<SoSeparator*>(sep->getChild(4));
|
||||
updateArrow(subsep, 0, dia/8 + dia/2 * rat2, dia/8);
|
||||
const SoSeparator *sep = static_cast<SoSeparator *>(pShapeSep->getChild(3));
|
||||
updatePlacement(sep, 2, SbVec3f(0, dia / 8 + dia / 2 * rat1, 0), SbRotation());
|
||||
const SoSeparator *subsep = static_cast<SoSeparator *>(sep->getChild(4));
|
||||
updateArrow(subsep, 0, dia / 8 + dia / 2 * rat1, dia / 8);
|
||||
sep = static_cast<SoSeparator *>(pShapeSep->getChild(4));
|
||||
updatePlacement(sep, 2, SbVec3f(0, dia / 8 + dia / 2 * rat2, 0), SbRotation());
|
||||
subsep = static_cast<SoSeparator *>(sep->getChild(4));
|
||||
updateArrow(subsep, 0, dia / 8 + dia / 2 * rat2, dia / 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,24 +21,21 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#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/SbRotation.h>
|
||||
# include <Inventor/SbVec3f.h>
|
||||
# include <Inventor/nodes/SoMultipleCopy.h>
|
||||
# include <Inventor/nodes/SoSeparator.h>
|
||||
#endif
|
||||
|
||||
#include "Mod/Fem/App/FemConstraintSpring.h"
|
||||
#include "TaskFemConstraintSpring.h" //TODO do next
|
||||
#include "ViewProviderFemConstraintSpring.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/Control.h>
|
||||
#include "Mod/Fem/App/FemConstraintSpring.h"
|
||||
|
||||
#include "ViewProviderFemConstraintSpring.h"
|
||||
#include "TaskFemConstraintSpring.h" //TODO do next
|
||||
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
@@ -47,7 +44,7 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemConstraintSpring, FemGui::ViewProviderFem
|
||||
ViewProviderFemConstraintSpring::ViewProviderFemConstraintSpring()
|
||||
{
|
||||
sPixmap = "FEM_ConstraintSpring";
|
||||
ADD_PROPERTY(FaceColor,(0.0f,0.2f,0.8f));
|
||||
ADD_PROPERTY(FaceColor, (0.0f, 0.2f, 0.8f));
|
||||
}
|
||||
|
||||
ViewProviderFemConstraintSpring::~ViewProviderFemConstraintSpring()
|
||||
@@ -62,7 +59,8 @@ bool ViewProviderFemConstraintSpring::setEdit(int ModNum)
|
||||
// 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
|
||||
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) {
|
||||
@@ -97,7 +95,7 @@ bool ViewProviderFemConstraintSpring::setEdit(int ModNum)
|
||||
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());
|
||||
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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user