Mesh: Apply clang-format

This commit is contained in:
wmayer
2023-09-22 19:59:39 +02:00
committed by wwmayer
parent 70ba930230
commit 23db389a76
116 changed files with 15683 additions and 12447 deletions

View File

@@ -27,10 +27,11 @@
#include "FeatureMeshSolid.h"
namespace Mesh {
const App::PropertyIntegerConstraint::Constraints intSampling = {0, INT_MAX, 1};
const App::PropertyLength::Constraints floatRange = {0.0, FLT_MAX, 1.0};
}
namespace Mesh
{
const App::PropertyIntegerConstraint::Constraints intSampling = {0, INT_MAX, 1};
const App::PropertyLength::Constraints floatRange = {0.0, FLT_MAX, 1.0};
} // namespace Mesh
using namespace Mesh;
using namespace MeshCore;
@@ -47,14 +48,16 @@ Sphere::Sphere()
short Sphere::mustExecute() const
{
if (Radius.isTouched() || Sampling.isTouched())
if (Radius.isTouched() || Sampling.isTouched()) {
return 1;
}
return Feature::mustExecute();
}
App::DocumentObjectExecReturn *Sphere::execute()
App::DocumentObjectExecReturn* Sphere::execute()
{
std::unique_ptr<MeshObject> mesh(MeshObject::createSphere((float)Radius.getValue(),Sampling.getValue()));
std::unique_ptr<MeshObject> mesh(
MeshObject::createSphere((float)Radius.getValue(), Sampling.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
Mesh.setValue(mesh->getKernel());
@@ -65,7 +68,9 @@ App::DocumentObjectExecReturn *Sphere::execute()
}
}
void Sphere::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
void Sphere::handleChangedPropertyType(Base::XMLReader& reader,
const char* TypeName,
App::Property* prop)
{
if (prop == &Radius && strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
App::PropertyFloatConstraint r;
@@ -83,9 +88,9 @@ PROPERTY_SOURCE(Mesh::Ellipsoid, Mesh::Feature)
Ellipsoid::Ellipsoid()
{
ADD_PROPERTY(Radius1 ,(2.0));
ADD_PROPERTY(Radius2 ,(4.0));
ADD_PROPERTY(Sampling ,(50));
ADD_PROPERTY(Radius1, (2.0));
ADD_PROPERTY(Radius2, (4.0));
ADD_PROPERTY(Sampling, (50));
Radius1.setConstraints(&floatRange);
Radius2.setConstraints(&floatRange);
Sampling.setConstraints(&intSampling);
@@ -93,16 +98,17 @@ Ellipsoid::Ellipsoid()
short Ellipsoid::mustExecute() const
{
if (Radius1.isTouched() ||
Radius2.isTouched() ||
Sampling.isTouched())
if (Radius1.isTouched() || Radius2.isTouched() || Sampling.isTouched()) {
return 1;
}
return Feature::mustExecute();
}
App::DocumentObjectExecReturn *Ellipsoid::execute()
App::DocumentObjectExecReturn* Ellipsoid::execute()
{
std::unique_ptr<MeshObject> mesh(MeshObject::createEllipsoid((float)Radius1.getValue(),(float)Radius2.getValue(),Sampling.getValue()));
std::unique_ptr<MeshObject> mesh(MeshObject::createEllipsoid((float)Radius1.getValue(),
(float)Radius2.getValue(),
Sampling.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
Mesh.setValue(mesh->getKernel());
@@ -113,10 +119,12 @@ App::DocumentObjectExecReturn *Ellipsoid::execute()
}
}
void Ellipsoid::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
void Ellipsoid::handleChangedPropertyType(Base::XMLReader& reader,
const char* TypeName,
App::Property* prop)
{
if ((prop == &Radius1 || prop == &Radius2) &&
strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
if ((prop == &Radius1 || prop == &Radius2)
&& strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
App::PropertyFloatConstraint r;
r.Restore(reader);
static_cast<App::PropertyLength*>(prop)->setValue(r.getValue());
@@ -132,11 +140,11 @@ PROPERTY_SOURCE(Mesh::Cylinder, Mesh::Feature)
Cylinder::Cylinder()
{
ADD_PROPERTY(Radius ,(2.0));
ADD_PROPERTY(Length ,(10.0));
ADD_PROPERTY(EdgeLength,(1.0));
ADD_PROPERTY(Closed ,(true));
ADD_PROPERTY(Sampling ,(50));
ADD_PROPERTY(Radius, (2.0));
ADD_PROPERTY(Length, (10.0));
ADD_PROPERTY(EdgeLength, (1.0));
ADD_PROPERTY(Closed, (true));
ADD_PROPERTY(Sampling, (50));
Radius.setConstraints(&floatRange);
Length.setConstraints(&floatRange);
EdgeLength.setConstraints(&floatRange);
@@ -145,19 +153,20 @@ Cylinder::Cylinder()
short Cylinder::mustExecute() const
{
if (Radius.isTouched() ||
Length.isTouched() ||
EdgeLength.isTouched() ||
Closed.isTouched() ||
Sampling.isTouched())
if (Radius.isTouched() || Length.isTouched() || EdgeLength.isTouched() || Closed.isTouched()
|| Sampling.isTouched()) {
return 1;
}
return Feature::mustExecute();
}
App::DocumentObjectExecReturn *Cylinder::execute()
App::DocumentObjectExecReturn* Cylinder::execute()
{
std::unique_ptr<MeshObject> mesh(MeshObject::createCylinder((float)Radius.getValue(),(float)Length.getValue(),
Closed.getValue(),(float)EdgeLength.getValue(),Sampling.getValue()));
std::unique_ptr<MeshObject> mesh(MeshObject::createCylinder((float)Radius.getValue(),
(float)Length.getValue(),
Closed.getValue(),
(float)EdgeLength.getValue(),
Sampling.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
Mesh.setValue(mesh->getKernel());
@@ -168,10 +177,12 @@ App::DocumentObjectExecReturn *Cylinder::execute()
}
}
void Cylinder::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
void Cylinder::handleChangedPropertyType(Base::XMLReader& reader,
const char* TypeName,
App::Property* prop)
{
if ((prop == &Radius || prop == &Length || prop == &EdgeLength) &&
strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
if ((prop == &Radius || prop == &Length || prop == &EdgeLength)
&& strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
App::PropertyFloatConstraint r;
r.Restore(reader);
static_cast<App::PropertyLength*>(prop)->setValue(r.getValue());
@@ -187,12 +198,12 @@ PROPERTY_SOURCE(Mesh::Cone, Mesh::Feature)
Cone::Cone()
{
ADD_PROPERTY(Radius1 ,(2.0));
ADD_PROPERTY(Radius2 ,(4.0));
ADD_PROPERTY(Length ,(10.0));
ADD_PROPERTY(EdgeLength,(1.0));
ADD_PROPERTY(Closed ,(true));
ADD_PROPERTY(Sampling ,(50));
ADD_PROPERTY(Radius1, (2.0));
ADD_PROPERTY(Radius2, (4.0));
ADD_PROPERTY(Length, (10.0));
ADD_PROPERTY(EdgeLength, (1.0));
ADD_PROPERTY(Closed, (true));
ADD_PROPERTY(Sampling, (50));
Radius1.setConstraints(&floatRange);
Radius2.setConstraints(&floatRange);
Length.setConstraints(&floatRange);
@@ -202,20 +213,21 @@ Cone::Cone()
short Cone::mustExecute() const
{
if (Radius1.isTouched() ||
Radius2.isTouched() ||
Length.isTouched() ||
EdgeLength.isTouched() ||
Closed.isTouched() ||
Sampling.isTouched())
if (Radius1.isTouched() || Radius2.isTouched() || Length.isTouched() || EdgeLength.isTouched()
|| Closed.isTouched() || Sampling.isTouched()) {
return 1;
}
return Feature::mustExecute();
}
App::DocumentObjectExecReturn *Cone::execute()
App::DocumentObjectExecReturn* Cone::execute()
{
std::unique_ptr<MeshObject> mesh(MeshObject::createCone((float)Radius1.getValue(),(float)Radius2.getValue(),(float)Length.getValue(),
Closed.getValue(),(float)EdgeLength.getValue(),Sampling.getValue()));
std::unique_ptr<MeshObject> mesh(MeshObject::createCone((float)Radius1.getValue(),
(float)Radius2.getValue(),
(float)Length.getValue(),
Closed.getValue(),
(float)EdgeLength.getValue(),
Sampling.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
Mesh.setValue(mesh->getKernel());
@@ -226,10 +238,12 @@ App::DocumentObjectExecReturn *Cone::execute()
}
}
void Cone::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
void Cone::handleChangedPropertyType(Base::XMLReader& reader,
const char* TypeName,
App::Property* prop)
{
if ((prop == &Radius1 || prop == &Radius2 || prop == &Length || prop == &EdgeLength) &&
strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
if ((prop == &Radius1 || prop == &Radius2 || prop == &Length || prop == &EdgeLength)
&& strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
App::PropertyFloatConstraint r;
r.Restore(reader);
static_cast<App::PropertyLength*>(prop)->setValue(r.getValue());
@@ -245,9 +259,9 @@ PROPERTY_SOURCE(Mesh::Torus, Mesh::Feature)
Torus::Torus()
{
ADD_PROPERTY(Radius1 ,(10.0));
ADD_PROPERTY(Radius2 ,(2.0));
ADD_PROPERTY(Sampling ,(50));
ADD_PROPERTY(Radius1, (10.0));
ADD_PROPERTY(Radius2, (2.0));
ADD_PROPERTY(Sampling, (50));
Radius1.setConstraints(&floatRange);
Radius2.setConstraints(&floatRange);
Sampling.setConstraints(&intSampling);
@@ -255,16 +269,17 @@ Torus::Torus()
short Torus::mustExecute() const
{
if (Radius1.isTouched() ||
Radius2.isTouched() ||
Sampling.isTouched())
if (Radius1.isTouched() || Radius2.isTouched() || Sampling.isTouched()) {
return 1;
}
return Feature::mustExecute();
}
App::DocumentObjectExecReturn *Torus::execute()
App::DocumentObjectExecReturn* Torus::execute()
{
std::unique_ptr<MeshObject> mesh(MeshObject::createTorus((float)Radius1.getValue(),(float)Radius2.getValue(),Sampling.getValue()));
std::unique_ptr<MeshObject> mesh(MeshObject::createTorus((float)Radius1.getValue(),
(float)Radius2.getValue(),
Sampling.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
Mesh.setValue(mesh->getKernel());
@@ -275,10 +290,12 @@ App::DocumentObjectExecReturn *Torus::execute()
}
}
void Torus::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
void Torus::handleChangedPropertyType(Base::XMLReader& reader,
const char* TypeName,
App::Property* prop)
{
if ((prop == &Radius1 || prop == &Radius2) &&
strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
if ((prop == &Radius1 || prop == &Radius2)
&& strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
App::PropertyFloatConstraint r;
r.Restore(reader);
static_cast<App::PropertyLength*>(prop)->setValue(r.getValue());
@@ -294,9 +311,9 @@ PROPERTY_SOURCE(Mesh::Cube, Mesh::Feature)
Cube::Cube()
{
ADD_PROPERTY_TYPE(Length,(10.0f),"Cube",App::Prop_None,"The length of the cube");
ADD_PROPERTY_TYPE(Width ,(10.0f),"Cube",App::Prop_None,"The width of the cube");
ADD_PROPERTY_TYPE(Height,(10.0f),"Cube",App::Prop_None,"The height of the cube");
ADD_PROPERTY_TYPE(Length, (10.0f), "Cube", App::Prop_None, "The length of the cube");
ADD_PROPERTY_TYPE(Width, (10.0f), "Cube", App::Prop_None, "The width of the cube");
ADD_PROPERTY_TYPE(Height, (10.0f), "Cube", App::Prop_None, "The height of the cube");
Length.setConstraints(&floatRange);
Width.setConstraints(&floatRange);
Height.setConstraints(&floatRange);
@@ -304,16 +321,17 @@ Cube::Cube()
short Cube::mustExecute() const
{
if (Length.isTouched() ||
Width.isTouched() ||
Height.isTouched())
if (Length.isTouched() || Width.isTouched() || Height.isTouched()) {
return 1;
}
return Feature::mustExecute();
}
App::DocumentObjectExecReturn *Cube::execute()
App::DocumentObjectExecReturn* Cube::execute()
{
std::unique_ptr<MeshObject> mesh(MeshObject::createCube((float)Length.getValue(),(float)Width.getValue(),(float)Height.getValue()));
std::unique_ptr<MeshObject> mesh(MeshObject::createCube((float)Length.getValue(),
(float)Width.getValue(),
(float)Height.getValue()));
if (mesh.get()) {
mesh->setPlacement(this->Placement.getValue());
Mesh.setValue(mesh->getKernel());
@@ -324,10 +342,12 @@ App::DocumentObjectExecReturn *Cube::execute()
}
}
void Cube::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
void Cube::handleChangedPropertyType(Base::XMLReader& reader,
const char* TypeName,
App::Property* prop)
{
if ((prop == &Length || prop == &Width || prop == &Height) &&
strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
if ((prop == &Length || prop == &Width || prop == &Height)
&& strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
App::PropertyFloatConstraint r;
r.Restore(reader);
static_cast<App::PropertyLength*>(prop)->setValue(r.getValue());