whitespace improvements

This commit is contained in:
wmayer 2016-08-04 17:26:12 +02:00
parent 02b84bd2e1
commit 1c89c566c9
7 changed files with 220 additions and 221 deletions

View File

@ -450,23 +450,23 @@ QString Unit::getString(void) const
QString Unit::getTypeString(void) const QString Unit::getTypeString(void) const
{ {
if(*this == Unit::Length ) return QString::fromLatin1("Length"); else if(*this == Unit::Length ) return QString::fromLatin1("Length"); else
if(*this == Unit::Area ) return QString::fromLatin1("Area"); else if(*this == Unit::Area ) return QString::fromLatin1("Area"); else
if(*this == Unit::Volume ) return QString::fromLatin1("Volume"); else if(*this == Unit::Volume ) return QString::fromLatin1("Volume"); else
if(*this == Unit::Mass ) return QString::fromLatin1("Mass"); else if(*this == Unit::Mass ) return QString::fromLatin1("Mass"); else
if(*this == Unit::Angle ) return QString::fromLatin1("Angle"); else if(*this == Unit::Angle ) return QString::fromLatin1("Angle"); else
if(*this == Unit::Density ) return QString::fromLatin1("Density"); else if(*this == Unit::Density ) return QString::fromLatin1("Density"); else
if(*this == Unit::TimeSpan ) return QString::fromLatin1("TimeSpan"); else if(*this == Unit::TimeSpan ) return QString::fromLatin1("TimeSpan"); else
if(*this == Unit::Velocity ) return QString::fromLatin1("Velocity"); else if(*this == Unit::Velocity ) return QString::fromLatin1("Velocity"); else
if(*this == Unit::Acceleration ) return QString::fromLatin1("Acceleration"); else if(*this == Unit::Acceleration ) return QString::fromLatin1("Acceleration"); else
if(*this == Unit::Temperature ) return QString::fromLatin1("Temperature"); else if(*this == Unit::Temperature ) return QString::fromLatin1("Temperature"); else
if(*this == Unit::ElectricCurrent ) return QString::fromLatin1("ElectricCurrent"); else if(*this == Unit::ElectricCurrent ) return QString::fromLatin1("ElectricCurrent"); else
if(*this == Unit::AmountOfSubstance ) return QString::fromLatin1("AmountOfSubstance"); else if(*this == Unit::AmountOfSubstance ) return QString::fromLatin1("AmountOfSubstance"); else
if(*this == Unit::LuminoseIntensity ) return QString::fromLatin1("LuminoseIntensity"); else if(*this == Unit::LuminoseIntensity ) return QString::fromLatin1("LuminoseIntensity"); else
if(*this == Unit::Pressure ) return QString::fromLatin1("Pressure"); else if(*this == Unit::Pressure ) return QString::fromLatin1("Pressure"); else
if(*this == Unit::Force ) return QString::fromLatin1("Force"); else if(*this == Unit::Force ) return QString::fromLatin1("Force"); else
if(*this == Unit::Work ) return QString::fromLatin1("Work"); else if(*this == Unit::Work ) return QString::fromLatin1("Work"); else
if(*this == Unit::Power ) return QString::fromLatin1("Power"); else if(*this == Unit::Power ) return QString::fromLatin1("Power"); else
if(*this == Unit::ThermalConductivity ) return QString::fromLatin1("ThermalConductivity"); else if(*this == Unit::ThermalConductivity ) return QString::fromLatin1("ThermalConductivity"); else
if(*this == Unit::ThermalExpansionCoefficient ) return QString::fromLatin1("ThermalExpansionCoefficient"); else if(*this == Unit::ThermalExpansionCoefficient ) return QString::fromLatin1("ThermalExpansionCoefficient"); else
if(*this == Unit::SpecificHeat ) return QString::fromLatin1("SpecificHeat"); else if(*this == Unit::SpecificHeat ) return QString::fromLatin1("SpecificHeat"); else

View File

@ -85,36 +85,36 @@ public:
const UnitSignature & getSignature(void)const {return Sig;} const UnitSignature & getSignature(void)const {return Sig;}
bool isEmpty(void)const; bool isEmpty(void)const;
QString getString(void) const; QString getString(void) const;
/// get the type as an string such as "Area", "Length" or "Pressure". /// get the type as an string such as "Area", "Length" or "Pressure".
QString getTypeString(void) const; QString getTypeString(void) const;
/** Predefined Unit types. */ /** Predefined Unit types. */
//@{ //@{
/// Length unit /// Length unit
static Unit Length; static Unit Length;
/// Mass unit /// Mass unit
static Unit Mass; static Unit Mass;
/// Angle /// Angle
static Unit Angle; static Unit Angle;
static Unit Density; static Unit Density;
static Unit Area; static Unit Area;
static Unit Volume; static Unit Volume;
static Unit TimeSpan; static Unit TimeSpan;
static Unit Velocity; static Unit Velocity;
static Unit Acceleration; static Unit Acceleration;
static Unit Temperature; static Unit Temperature;
static Unit ElectricCurrent;
static Unit AmountOfSubstance;
static Unit LuminoseIntensity;
static Unit Stress; static Unit ElectricCurrent;
static Unit Pressure; static Unit AmountOfSubstance;
static Unit Force; static Unit LuminoseIntensity;
static Unit Work;
static Unit Power; static Unit Stress;
static Unit Pressure;
static Unit Force;
static Unit Work;
static Unit Power;
static Unit ThermalConductivity; static Unit ThermalConductivity;
static Unit ThermalExpansionCoefficient; static Unit ThermalExpansionCoefficient;

View File

@ -40,7 +40,7 @@ using namespace Base;
QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor,QString &unitString) QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor,QString &unitString)
{ {
double UnitValue = std::abs(quant.getValue()); double UnitValue = std::abs(quant.getValue());
Unit unit = quant.getUnit(); Unit unit = quant.getUnit();
// now do special treatment on all cases seams nececarry: // now do special treatment on all cases seams nececarry:
if(unit == Unit::Length){ // Length handling ============================ if(unit == Unit::Length){ // Length handling ============================
@ -93,13 +93,13 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor
factor = 1.0; factor = 1.0;
} }
}else if (unit == Unit::ThermalConductivity){ }else if (unit == Unit::ThermalConductivity){
if (UnitValue < 1000){ if (UnitValue < 1000){
unitString = QString::fromLatin1("W/mm/K"); unitString = QString::fromLatin1("W/mm/K");
factor = 1.0; factor = 1.0;
}else{ }else{
unitString = QString::fromLatin1("W/m/K"); unitString = QString::fromLatin1("W/m/K");
factor = 1000.0; factor = 1000.0;
} }
}else if (unit == Unit::ThermalExpansionCoefficient){ }else if (unit == Unit::ThermalExpansionCoefficient){
if(UnitValue < 0.001){ if(UnitValue < 0.001){
unitString = QString::fromLatin1("um/m/K"); unitString = QString::fromLatin1("um/m/K");
@ -111,7 +111,7 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor
}else if (unit == Unit::SpecificHeat){ }else if (unit == Unit::SpecificHeat){
unitString = QString::fromLatin1("J/kg/K"); unitString = QString::fromLatin1("J/kg/K");
factor = 1000000.0; factor = 1000000.0;
}else if (unit == Unit::ThermalTransferCoefficient){ }else if (unit == Unit::ThermalTransferCoefficient){
unitString = QString::fromLatin1("W/m^2/K"); unitString = QString::fromLatin1("W/m^2/K");
factor = 1.0; factor = 1.0;
}else if ((unit == Unit::Pressure) || (unit == Unit::Stress)){ }else if ((unit == Unit::Pressure) || (unit == Unit::Stress)){

View File

@ -127,40 +127,39 @@ void ViewProviderFemConstraintContact::updateData(const App::Property* prop)
SbVec3f base(p->x, p->y, p->z); SbVec3f base(p->x, p->y, p->z);
SbVec3f dir(n->x, n->y, n->z);//normal SbVec3f dir(n->x, n->y, n->z);//normal
///Visual indication ///Visual indication
//define separator //define separator
SoSeparator* sep = new SoSeparator(); SoSeparator* sep = new SoSeparator();
//first move to correct postion //first move to correct postion
SoTranslation* trans = new SoTranslation(); SoTranslation* trans = new SoTranslation();
SbVec3f newPos=base+scaledheight*dir*0.12; SbVec3f newPos=base+scaledheight*dir*0.12f;
trans->translation.setValue(newPos); trans->translation.setValue(newPos);
sep->addChild(trans); sep->addChild(trans);
//adjust orientation //adjust orientation
SoRotation* rot = new SoRotation(); SoRotation* rot = new SoRotation();
rot->rotation.setValue(SbRotation(SbVec3f(0,1,0),dir)); rot->rotation.setValue(SbRotation(SbVec3f(0,1,0),dir));
sep->addChild(rot); sep->addChild(rot);
//define color of shape //define color of shape
SoMaterial* myMaterial = new SoMaterial; SoMaterial* myMaterial = new SoMaterial;
myMaterial->diffuseColor.set1Value(0,SbColor(1,1,1));//RGB myMaterial->diffuseColor.set1Value(0,SbColor(1,1,1));//RGB
//myMaterial->diffuseColor.set1Value(1,SbColor(0,0,1));//possible to adjust sides separately //myMaterial->diffuseColor.set1Value(1,SbColor(0,0,1));//possible to adjust sides separately
sep->addChild(myMaterial); sep->addChild(myMaterial);
//draw a cube //draw a cube
SoCube* cbe = new SoCube(); SoCube* cbe = new SoCube();
cbe->depth.setValue(scaledlength*0.5); cbe->depth.setValue(scaledlength*0.5);
cbe->height.setValue(scaledheight*0.25); cbe->height.setValue(scaledheight*0.25);
cbe->width.setValue(scaledwidth*0.75); cbe->width.setValue(scaledwidth*0.75);
sep->addChild(cbe); sep->addChild(cbe);
//translate postion //translate postion
SoTranslation* trans2 = new SoTranslation(); SoTranslation* trans2 = new SoTranslation();
trans2->translation.setValue(SbVec3f(0,0,0)); trans2->translation.setValue(SbVec3f(0,0,0));
sep->addChild(trans2); sep->addChild(trans2);
pShapeSep->addChild(sep);
pShapeSep->addChild(sep);
n++; n++;
} }
} }

View File

@ -126,65 +126,65 @@ void ViewProviderFemConstraintHeatflux::updateData(const App::Property* prop)
SbVec3f base(p->x, p->y, p->z); SbVec3f base(p->x, p->y, p->z);
SbVec3f dir(n->x, n->y, n->z);//normal SbVec3f dir(n->x, n->y, n->z);//normal
///Temperature indication ///Temperature indication
//define separator //define separator
SoSeparator* sep = new SoSeparator(); SoSeparator* sep = new SoSeparator();
///draw a temp gauge,with sphere and a cylinder ///draw a temp gauge,with sphere and a cylinder
//first move to correct postion //first move to correct postion
SoTranslation* trans = new SoTranslation(); SoTranslation* trans = new SoTranslation();
SbVec3f newPos=base+scaledradius*dir*0.7; SbVec3f newPos=base+scaledradius*dir*0.7f;
trans->translation.setValue(newPos); trans->translation.setValue(newPos);
sep->addChild(trans); sep->addChild(trans);
//adjust orientation //adjust orientation
SoRotation* rot = new SoRotation(); SoRotation* rot = new SoRotation();
rot->rotation.setValue(SbRotation(SbVec3f(0,1,0),dir)); rot->rotation.setValue(SbRotation(SbVec3f(0,1,0),dir));
sep->addChild(rot); sep->addChild(rot);
//define color of shape //define color of shape
SoMaterial* myMaterial = new SoMaterial; SoMaterial* myMaterial = new SoMaterial;
myMaterial->diffuseColor.set1Value(0,SbColor(0.65,0.1,0.25));//RGB myMaterial->diffuseColor.set1Value(0,SbColor(0.65f,0.1f,0.25f));//RGB
//myMaterial->diffuseColor.set1Value(1,SbColor(.1,.1,.1));//possible to adjust sides separately //myMaterial->diffuseColor.set1Value(1,SbColor(.1,.1,.1));//possible to adjust sides separately
sep->addChild(myMaterial); sep->addChild(myMaterial);
//draw a sphere //draw a sphere
SoSphere* sph = new SoSphere(); SoSphere* sph = new SoSphere();
sph->radius.setValue(scaledradius*0.75); sph->radius.setValue(scaledradius*0.75);
sep->addChild(sph); sep->addChild(sph);
//translate postion //translate postion
SoTranslation* trans2 = new SoTranslation(); SoTranslation* trans2 = new SoTranslation();
trans2->translation.setValue(SbVec3f(0,scaledheight*0.375,0)); trans2->translation.setValue(SbVec3f(0,scaledheight*0.375,0));
sep->addChild(trans2); sep->addChild(trans2);
//draw a cylinder //draw a cylinder
SoCylinder* cyl = new SoCylinder(); SoCylinder* cyl = new SoCylinder();
cyl->height.setValue(scaledheight*0.5); cyl->height.setValue(scaledheight*0.5);
cyl->radius.setValue(scaledradius*0.375); cyl->radius.setValue(scaledradius*0.375);
sep->addChild(cyl); sep->addChild(cyl);
//translate postion //translate postion
SoTranslation* trans3 = new SoTranslation(); SoTranslation* trans3 = new SoTranslation();
trans3->translation.setValue(SbVec3f(0,scaledheight*0.375,0)); trans3->translation.setValue(SbVec3f(0,scaledheight*0.375,0));
sep->addChild(trans3); sep->addChild(trans3);
//define color of shape //define color of shape
SoMaterial *myMaterial2 = new SoMaterial; 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); sep->addChild(myMaterial2);
//draw a cylinder //draw a cylinder
SoCylinder* cyl2 = new SoCylinder(); SoCylinder* cyl2 = new SoCylinder();
cyl2->height.setValue(scaledheight*0.25); cyl2->height.setValue(scaledheight*0.25);
cyl2->radius.setValue(scaledradius*0.375); cyl2->radius.setValue(scaledradius*0.375);
sep->addChild(cyl2); sep->addChild(cyl2);
//translate postion //translate postion
SoTranslation* trans4 = new SoTranslation(); SoTranslation* trans4 = new SoTranslation();
trans4->translation.setValue(SbVec3f(0,-scaledheight*0.375,0)); trans4->translation.setValue(SbVec3f(0,-scaledheight*0.375,0));
sep->addChild(trans4); sep->addChild(trans4);
//draw a cylinder //draw a cylinder
SoCylinder* cyl3 = new SoCylinder(); SoCylinder* cyl3 = new SoCylinder();
cyl3->height.setValue(scaledheight*0.05); cyl3->height.setValue(scaledheight*0.05);
cyl3->radius.setValue(scaledradius*1); cyl3->radius.setValue(scaledradius*1);
sep->addChild(cyl3); sep->addChild(cyl3);
pShapeSep->addChild(sep); pShapeSep->addChild(sep);
n++; n++;
} }

View File

@ -132,56 +132,56 @@ void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* pro
* This gets drawn at every point. * This gets drawn at every point.
* */ * */
///Visual indication ///Visual indication
//define separator //define separator
SoSeparator* sep = new SoSeparator(); SoSeparator* sep = new SoSeparator();
///draw a temp gauge,with sphere and a cylinder ///draw a temp gauge,with sphere and a cylinder
//first move to correct postion //first move to correct postion
SoTranslation* trans = new SoTranslation(); SoTranslation* trans = new SoTranslation();
SbVec3f newPos=base+scaledradius*dir*0.08; SbVec3f newPos=base+scaledradius*dir*0.08f;
trans->translation.setValue(newPos); trans->translation.setValue(newPos);
sep->addChild(trans); sep->addChild(trans);
//adjust orientation //adjust orientation
SoRotation* rot = new SoRotation(); SoRotation* rot = new SoRotation();
rot->rotation.setValue(SbRotation(SbVec3f(1,0,0),dir)); rot->rotation.setValue(SbRotation(SbVec3f(1,0,0),dir));
sep->addChild(rot); sep->addChild(rot);
//define color of shape //define color of shape
SoMaterial* myMaterial = new SoMaterial; SoMaterial* myMaterial = new SoMaterial;
myMaterial->diffuseColor.set1Value(0,SbColor(0,1,0));//RGB myMaterial->diffuseColor.set1Value(0,SbColor(0,1,0));//RGB
//myMaterial->diffuseColor.set1Value(1,SbColor(0,0,1));//possible to adjust sides separately //myMaterial->diffuseColor.set1Value(1,SbColor(0,0,1));//possible to adjust sides separately
sep->addChild(myMaterial); sep->addChild(myMaterial);
//draw a sphere //draw a sphere
//SoSphere* sph = new SoSphere(); //SoSphere* sph = new SoSphere();
//sph->radius.setValue(scaledradius*0.75); //sph->radius.setValue(scaledradius*0.75);
//sep->addChild(sph); //sep->addChild(sph);
//translate postion //translate postion
//SoTranslation* trans2 = new SoTranslation(); //SoTranslation* trans2 = new SoTranslation();
//trans2->translation.setValue(SbVec3f(0,scaledheight*0.375,0)); //trans2->translation.setValue(SbVec3f(0,scaledheight*0.375,0));
//sep->addChild(trans2); //sep->addChild(trans2);
//draw a cylinder //draw a cylinder
SoCylinder* cyl = new SoCylinder(); SoCylinder* cyl = new SoCylinder();
cyl->height.setValue(scaledheight*0.5); cyl->height.setValue(scaledheight*0.5);
cyl->radius.setValue(scaledradius*0.375); cyl->radius.setValue(scaledradius*0.375);
sep->addChild(cyl); sep->addChild(cyl);
//translate postion //translate postion
//SoTranslation* trans3 = new SoTranslation(); //SoTranslation* trans3 = new SoTranslation();
//trans3->translation.setValue(SbVec3f(0,scaledheight*0.05,0)); //trans3->translation.setValue(SbVec3f(0,scaledheight*0.05,0));
//sep->addChild(trans3); //sep->addChild(trans3);
//define color of shape //define color of shape
SoMaterial *myMaterial2 = new SoMaterial; 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); sep->addChild(myMaterial2);
//draw a cylinder //draw a cylinder
//SoCylinder* cyl2 = new SoCylinder(); //SoCylinder* cyl2 = new SoCylinder();
//cyl2->height.setValue(scaledheight*0.25); //cyl2->height.setValue(scaledheight*0.25);
//cyl2->radius.setValue(scaledradius*0.375); //cyl2->radius.setValue(scaledradius*0.375);
//sep->addChild(cyl2); //sep->addChild(cyl2);
pShapeSep->addChild(sep); pShapeSep->addChild(sep);
n++; n++;
} }

View File

@ -125,56 +125,56 @@ void ViewProviderFemConstraintTemperature::updateData(const App::Property* prop)
SbVec3f base(p->x, p->y, p->z); SbVec3f base(p->x, p->y, p->z);
SbVec3f dir(n->x, n->y, n->z);//normal SbVec3f dir(n->x, n->y, n->z);//normal
///Temperature indication ///Temperature indication
//define separator //define separator
SoSeparator* sep = new SoSeparator(); SoSeparator* sep = new SoSeparator();
///draw a temp gauge,with sphere and a cylinder ///draw a temp gauge,with sphere and a cylinder
//first move to correct postion //first move to correct postion
SoTranslation* trans = new SoTranslation(); SoTranslation* trans = new SoTranslation();
SbVec3f newPos=base+scaledradius*dir*0.7; SbVec3f newPos=base+scaledradius*dir*0.7f;
trans->translation.setValue(newPos); trans->translation.setValue(newPos);
sep->addChild(trans); sep->addChild(trans);
//adjust orientation //adjust orientation
SoRotation* rot = new SoRotation(); SoRotation* rot = new SoRotation();
rot->rotation.setValue(SbRotation(SbVec3f(0,1,0),dir)); rot->rotation.setValue(SbRotation(SbVec3f(0,1,0),dir));
sep->addChild(rot); sep->addChild(rot);
//define color of shape //define color of shape
SoMaterial* myMaterial = new SoMaterial; SoMaterial* myMaterial = new SoMaterial;
myMaterial->diffuseColor.set1Value(0,SbColor(1,0,0));//RGB myMaterial->diffuseColor.set1Value(0,SbColor(1,0,0));//RGB
//myMaterial->diffuseColor.set1Value(1,SbColor(.1,.1,.1));//possible to adjust sides separately //myMaterial->diffuseColor.set1Value(1,SbColor(.1,.1,.1));//possible to adjust sides separately
sep->addChild(myMaterial); sep->addChild(myMaterial);
//draw a sphere //draw a sphere
SoSphere* sph = new SoSphere(); SoSphere* sph = new SoSphere();
sph->radius.setValue(scaledradius*0.75); sph->radius.setValue(scaledradius*0.75);
sep->addChild(sph); sep->addChild(sph);
//translate postion //translate postion
SoTranslation* trans2 = new SoTranslation(); SoTranslation* trans2 = new SoTranslation();
trans2->translation.setValue(SbVec3f(0,scaledheight*0.375,0)); trans2->translation.setValue(SbVec3f(0,scaledheight*0.375,0));
sep->addChild(trans2); sep->addChild(trans2);
//draw a cylinder //draw a cylinder
SoCylinder* cyl = new SoCylinder(); SoCylinder* cyl = new SoCylinder();
cyl->height.setValue(scaledheight*0.5); cyl->height.setValue(scaledheight*0.5);
cyl->radius.setValue(scaledradius*0.375); cyl->radius.setValue(scaledradius*0.375);
sep->addChild(cyl); sep->addChild(cyl);
//translate postion //translate postion
SoTranslation* trans3 = new SoTranslation(); SoTranslation* trans3 = new SoTranslation();
trans3->translation.setValue(SbVec3f(0,scaledheight*0.375,0)); trans3->translation.setValue(SbVec3f(0,scaledheight*0.375,0));
sep->addChild(trans3); sep->addChild(trans3);
//define color of shape //define color of shape
SoMaterial *myMaterial2 = new SoMaterial; 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); sep->addChild(myMaterial2);
//draw a cylinder //draw a cylinder
SoCylinder* cyl2 = new SoCylinder(); SoCylinder* cyl2 = new SoCylinder();
cyl2->height.setValue(scaledheight*0.25); cyl2->height.setValue(scaledheight*0.25);
cyl2->radius.setValue(scaledradius*0.375); cyl2->radius.setValue(scaledradius*0.375);
sep->addChild(cyl2); sep->addChild(cyl2);
pShapeSep->addChild(sep); pShapeSep->addChild(sep);
n++; n++;
} }