modernize C++: use bool literals
This commit is contained in:
@@ -97,7 +97,7 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux(
|
||||
|
||||
std::string constraint_type = pcConstraint->ConstraintType.getValueAsString();
|
||||
if (constraint_type == "Convection") {
|
||||
ui->rb_convection->setChecked(1);
|
||||
ui->rb_convection->setChecked(true);
|
||||
ui->sw_heatflux->setCurrentIndex(0);
|
||||
Base::Quantity t =
|
||||
Base::Quantity(pcConstraint->AmbientTemp.getValue(), Base::Unit::Temperature);
|
||||
@@ -107,7 +107,7 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux(
|
||||
ui->if_filmcoef->setValue(f);
|
||||
}
|
||||
else if (constraint_type == "DFlux") {
|
||||
ui->rb_dflux->setChecked(1);
|
||||
ui->rb_dflux->setChecked(true);
|
||||
ui->sw_heatflux->setCurrentIndex(1);
|
||||
Base::Quantity c = Base::Quantity(pcConstraint->DFlux.getValue(), Base::Unit::HeatFlux);
|
||||
ui->if_heatflux->setValue(c);
|
||||
|
||||
@@ -70,14 +70,14 @@ TaskFemConstraintTemperature::TaskFemConstraintTemperature(
|
||||
|
||||
std::string constraint_type = pcConstraint->ConstraintType.getValueAsString();
|
||||
if (constraint_type == "Temperature") {
|
||||
ui->rb_temperature->setChecked(1);
|
||||
ui->rb_temperature->setChecked(true);
|
||||
ui->if_temperature->setValue(pcConstraint->Temperature.getQuantityValue());
|
||||
|
||||
ui->if_temperature->bind(pcConstraint->Temperature);
|
||||
ui->if_temperature->setUnit(pcConstraint->Temperature.getUnit());
|
||||
}
|
||||
else if (constraint_type == "CFlux") {
|
||||
ui->rb_cflux->setChecked(1);
|
||||
ui->rb_cflux->setChecked(true);
|
||||
std::string str = "Concentrated heat flux";
|
||||
ui->if_temperature->setValue(pcConstraint->CFlux.getQuantityValue());
|
||||
ui->if_temperature->bind(pcConstraint->CFlux);
|
||||
|
||||
@@ -98,13 +98,13 @@ TaskFemConstraintTransform::TaskFemConstraintTransform(
|
||||
std::string transform_type = pcConstraint->TransformType.getValueAsString();
|
||||
if (transform_type == "Rectangular") {
|
||||
ui->sw_transform->setCurrentIndex(0);
|
||||
ui->rb_rect->setChecked(1);
|
||||
ui->rb_cylin->setChecked(0);
|
||||
ui->rb_rect->setChecked(true);
|
||||
ui->rb_cylin->setChecked(false);
|
||||
}
|
||||
else if (transform_type == "Cylindrical") {
|
||||
ui->sw_transform->setCurrentIndex(1);
|
||||
ui->rb_rect->setChecked(0);
|
||||
ui->rb_cylin->setChecked(1);
|
||||
ui->rb_rect->setChecked(false);
|
||||
ui->rb_cylin->setChecked(true);
|
||||
}
|
||||
|
||||
ui->lw_Rect->clear();
|
||||
|
||||
@@ -734,7 +734,7 @@ bool ViewProviderFemPostObject::setupPipeline()
|
||||
// Therefore the only way is the hack to filter only if the used Elmer CPU cores are > 1.
|
||||
auto hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Fem/Elmer");
|
||||
bool FilterMultiCPUResults = hGrp->GetBool("FilterMultiCPUResults", 1);
|
||||
bool FilterMultiCPUResults = hGrp->GetBool("FilterMultiCPUResults", true);
|
||||
int UseNumberOfCores = hGrp->GetInt("UseNumberOfCores", 1);
|
||||
// filtering is only necessary for pipelines and warp filters
|
||||
if (FilterMultiCPUResults && (UseNumberOfCores > 1)
|
||||
|
||||
@@ -184,7 +184,7 @@ void ExportOCAF::createNode(App::Part* part, int& root_id,
|
||||
{
|
||||
TDF_Label shapeLabel = aShapeTool->NewShape();
|
||||
Handle(TDataStd_Name) N;
|
||||
TDataStd_Name::Set(shapeLabel, TCollection_ExtendedString(part->Label.getValue(), 1));
|
||||
TDataStd_Name::Set(shapeLabel, TCollection_ExtendedString(part->Label.getValue(), true));
|
||||
|
||||
Base::Placement pl = part->Placement.getValue();
|
||||
Base::Rotation rot(pl.getRotation());
|
||||
@@ -241,7 +241,7 @@ int ExportOCAF::saveShape(Part::Feature* part, const std::vector<App::Color>& co
|
||||
TDF_Label shapeLabel = aShapeTool->NewShape();
|
||||
aShapeTool->SetShape(shapeLabel, baseShape);
|
||||
|
||||
TDataStd_Name::Set(shapeLabel, TCollection_ExtendedString(part->Label.getValue(), 1));
|
||||
TDataStd_Name::Set(shapeLabel, TCollection_ExtendedString(part->Label.getValue(), true));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -346,7 +346,7 @@ App::DocumentObject *ImportOCAF2::expandShape(
|
||||
std::vector<App::DocumentObject*> objs;
|
||||
|
||||
if(shape.ShapeType() == TopAbs_COMPOUND) {
|
||||
for(TopoDS_Iterator it(shape,0,0);it.More();it.Next()) {
|
||||
for(TopoDS_Iterator it(shape,Standard_False,Standard_False);it.More();it.Next()) {
|
||||
TDF_Label childLabel;
|
||||
if(!label.IsNull())
|
||||
aShapeTool->FindSubShape(label,it.Value(),childLabel);
|
||||
@@ -671,7 +671,7 @@ void ImportOCAF2::getSHUOColors(TDF_Label label,
|
||||
// appendFirst tells us whether we shall append the object name of the first label
|
||||
bool skipFirst = !appendFirst;
|
||||
ss.str("");
|
||||
while(1) {
|
||||
while(true) {
|
||||
if(skipFirst)
|
||||
skipFirst = false;
|
||||
else {
|
||||
@@ -798,7 +798,7 @@ bool ImportOCAF2::createAssembly(App::Document *_doc,
|
||||
if(newDoc)
|
||||
doc = getDocument(_doc,label);
|
||||
|
||||
for(TopoDS_Iterator it(shape,0,0);it.More();it.Next()) {
|
||||
for(TopoDS_Iterator it(shape,Standard_False,Standard_False);it.More();it.Next()) {
|
||||
TopoDS_Shape childShape = it.Value();
|
||||
if(childShape.IsNull())
|
||||
continue;
|
||||
@@ -940,7 +940,7 @@ void ExportOCAF2::setName(TDF_Label label, App::DocumentObject *obj, const char
|
||||
return;
|
||||
name = obj->Label.getValue();
|
||||
}
|
||||
TDataStd_Name::Set(label, TCollection_ExtendedString(name, 1));
|
||||
TDataStd_Name::Set(label, TCollection_ExtendedString(name, true));
|
||||
}
|
||||
|
||||
// Similar to XCAFDoc_ShapeTool::FindSHUO but return only main SHUO, i.e. SHUO
|
||||
@@ -1219,7 +1219,7 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj,
|
||||
int depth = 0;
|
||||
auto linked = obj;
|
||||
auto linkedShape = shape;
|
||||
while(1) {
|
||||
while(true) {
|
||||
auto s = Part::Feature::getTopoShape(linked);
|
||||
if(s.isNull() || !s.getShape().IsPartner(shape.getShape()))
|
||||
break;
|
||||
|
||||
@@ -644,7 +644,7 @@ void LscmRelax::rotate_by_min_bound_area()
|
||||
double phi;
|
||||
double min_phi = 0;
|
||||
double min_area = 0;
|
||||
bool x_dominant = 0;
|
||||
bool x_dominant = false;
|
||||
// rotate vector by 90 degree and find min area
|
||||
for (int i = 0; i < n + 1; i++ )
|
||||
{
|
||||
|
||||
@@ -2598,7 +2598,7 @@ void GeomArcOfCircle::Restore(Base::XMLReader &reader)
|
||||
GC_MakeCircle mc(xdir, Radius);
|
||||
if (!mc.IsDone())
|
||||
THROWM(Base::CADKernelError,gce_ErrorStatusText(mc.Status()))
|
||||
GC_MakeArcOfCircle ma(mc.Value()->Circ(), StartAngle, EndAngle, 1);
|
||||
GC_MakeArcOfCircle ma(mc.Value()->Circ(), StartAngle, EndAngle, Standard_True);
|
||||
if (!ma.IsDone())
|
||||
THROWM(Base::CADKernelError,gce_ErrorStatusText(ma.Status()))
|
||||
|
||||
@@ -3123,7 +3123,7 @@ void GeomArcOfEllipse::Restore(Base::XMLReader &reader)
|
||||
if (!mc.IsDone())
|
||||
THROWM(Base::CADKernelError,gce_ErrorStatusText(mc.Status()))
|
||||
|
||||
GC_MakeArcOfEllipse ma(mc.Value()->Elips(), StartAngle, EndAngle, 1);
|
||||
GC_MakeArcOfEllipse ma(mc.Value()->Elips(), StartAngle, EndAngle, Standard_True);
|
||||
if (!ma.IsDone())
|
||||
THROWM(Base::CADKernelError,gce_ErrorStatusText(ma.Status()))
|
||||
|
||||
@@ -3549,7 +3549,7 @@ void GeomArcOfHyperbola::Restore(Base::XMLReader &reader)
|
||||
if (!mc.IsDone())
|
||||
THROWM(Base::CADKernelError,gce_ErrorStatusText(mc.Status()))
|
||||
|
||||
GC_MakeArcOfHyperbola ma(mc.Value()->Hypr(), StartAngle, EndAngle, 1);
|
||||
GC_MakeArcOfHyperbola ma(mc.Value()->Hypr(), StartAngle, EndAngle, Standard_True);
|
||||
if (!ma.IsDone())
|
||||
THROWM(Base::CADKernelError,gce_ErrorStatusText(ma.Status()))
|
||||
|
||||
@@ -3901,7 +3901,7 @@ void GeomArcOfParabola::Restore(Base::XMLReader &reader)
|
||||
if (!mc.IsDone())
|
||||
THROWM(Base::CADKernelError,gce_ErrorStatusText(mc.Status()))
|
||||
|
||||
GC_MakeArcOfParabola ma(mc.Value(), StartAngle, EndAngle, 1);
|
||||
GC_MakeArcOfParabola ma(mc.Value(), StartAngle, EndAngle, Standard_True);
|
||||
if (!ma.IsDone())
|
||||
THROWM(Base::CADKernelError,gce_ErrorStatusText(ma.Status()))
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ void FeatureExtrude::generatePrism(TopoDS_Shape& prism,
|
||||
// see e.g. https://forum.freecad.org/viewtopic.php?p=560785#p560785
|
||||
// It is better not to use BRepFeat_MakePrism here even if we have a support because the
|
||||
// resulting shape creates problems with Pocket
|
||||
BRepPrimAPI_MakePrism PrismMaker(from, Ltotal * gp_Vec(direction), 0, 1); // finite prism
|
||||
BRepPrimAPI_MakePrism PrismMaker(from, Ltotal * gp_Vec(direction), Standard_False, Standard_True); // finite prism
|
||||
if (!PrismMaker.IsDone())
|
||||
throw Base::RuntimeError("ProfileBased: Length: Could not extrude the sketch!");
|
||||
prism = PrismMaker.Shape();
|
||||
|
||||
@@ -594,7 +594,7 @@ void Helix::proposeParameters(bool force)
|
||||
|
||||
Pitch.setValue(pitch);
|
||||
Height.setValue(pitch * 3.0);
|
||||
HasBeenEdited.setValue(1);
|
||||
HasBeenEdited.setValue(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1260,9 +1260,9 @@ void Hole::onChanged(const App::Property* prop)
|
||||
CustomThreadClearance.setReadOnly(true);
|
||||
ThreadDepth.setReadOnly(true);
|
||||
ThreadDepthType.setReadOnly(true);
|
||||
Threaded.setValue(0);
|
||||
ModelThread.setValue(0);
|
||||
UseCustomThreadClearance.setValue(0);
|
||||
Threaded.setValue(false);
|
||||
ModelThread.setValue(false);
|
||||
UseCustomThreadClearance.setValue(false);
|
||||
}
|
||||
else if (type == "ISOMetricProfile") {
|
||||
ThreadSize.setEnums(ThreadSize_ISOmetric_Enums);
|
||||
|
||||
@@ -279,7 +279,7 @@ void fixSketchSupport (Sketcher::SketchObject* sketch)
|
||||
return; // Sketch is on a face of a solid, do nothing
|
||||
|
||||
const App::Document* doc = sketch->getDocument();
|
||||
PartDesign::Body *body = getBodyFor(sketch, /*messageIfNot*/ 0);
|
||||
PartDesign::Body *body = getBodyFor(sketch, /*messageIfNot*/ false);
|
||||
if (!body) {
|
||||
throw Base::RuntimeError ("Couldn't find body for the sketch");
|
||||
}
|
||||
|
||||
@@ -2203,7 +2203,7 @@ TopoDS_Shape Area::toShape(const CCurve& _c, const gp_Trsf* trsf, int reorient)
|
||||
double r = center.Distance(pt);
|
||||
double r2 = center.Distance(pnext);
|
||||
bool fix_arc = fabs(r - r2) > Precision::Confusion();
|
||||
while (1) {
|
||||
while (true) {
|
||||
if (fix_arc) {
|
||||
double d = pt.Distance(pnext);
|
||||
double rr = r * r;
|
||||
|
||||
@@ -1216,12 +1216,12 @@ const BaseGeomPtrVector DrawViewPart::getVisibleFaceEdges() const
|
||||
|
||||
bool DrawViewPart::handleFaces()
|
||||
{
|
||||
return Preferences::getPreferenceGroup("General")->GetBool("HandleFaces", 1l);
|
||||
return Preferences::getPreferenceGroup("General")->GetBool("HandleFaces", true);
|
||||
}
|
||||
|
||||
bool DrawViewPart::newFaceFinder(void)
|
||||
{
|
||||
return Preferences::getPreferenceGroup("General")->GetBool("NewFaceFinder", 0l);
|
||||
return Preferences::getPreferenceGroup("General")->GetBool("NewFaceFinder", false);
|
||||
}
|
||||
|
||||
//! remove features that are useless without this DVP
|
||||
@@ -1699,7 +1699,7 @@ bool DrawViewPart::prefIsoHid()
|
||||
|
||||
int DrawViewPart::prefIsoCount()
|
||||
{
|
||||
return Preferences::getPreferenceGroup("HLR")->GetBool("IsoCount", 0);
|
||||
return Preferences::getPreferenceGroup("HLR")->GetBool("IsoCount", false);
|
||||
}
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
@@ -1280,7 +1280,7 @@ void QGIViewPart::rotateView() {}
|
||||
bool QGIViewPart::prefFaceEdges()
|
||||
{
|
||||
bool result = false;
|
||||
result = Preferences::getPreferenceGroup("General")->GetBool("DrawFaceEdges", 0l);
|
||||
result = Preferences::getPreferenceGroup("General")->GetBool("DrawFaceEdges", false);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,8 +122,8 @@ public:
|
||||
}
|
||||
void init()
|
||||
{
|
||||
page->m_atCursor = hGrp->GetBool("ZoomAtCursor", 1l);
|
||||
page->m_invertZoom = hGrp->GetBool("InvertZoom", 0l);
|
||||
page->m_atCursor = hGrp->GetBool("ZoomAtCursor", true);
|
||||
page->m_invertZoom = hGrp->GetBool("InvertZoom", false);
|
||||
page->m_zoomIncrement = hGrp->GetFloat("ZoomStep", 0.02);
|
||||
|
||||
page->m_reversePan = Preferences::getPreferenceGroup("General")->GetInt("KbPan", 1);
|
||||
|
||||
@@ -100,7 +100,7 @@ void TaskLineDecor::getDefaults()
|
||||
m_style = LineFormat::getDefEdgeStyle();
|
||||
m_color = LineFormat::getDefEdgeColor();
|
||||
m_weight = LineFormat::getDefEdgeWidth();
|
||||
m_visible = 1;
|
||||
m_visible = true;
|
||||
|
||||
//set defaults to format of 1st edge
|
||||
if (!m_edges.empty()) {
|
||||
@@ -136,7 +136,7 @@ void TaskLineDecor::getDefaults()
|
||||
m_weight = partVP->LineWidth.getValue();
|
||||
m_style = Qt::SolidLine; // = 1
|
||||
m_color = LineFormat::getDefEdgeColor();
|
||||
m_visible = 1;
|
||||
m_visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user