[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2024-08-25 11:42:33 +00:00
parent 7cf6c4f5df
commit 7c6b8cc9ab
45 changed files with 1378 additions and 1040 deletions

View File

@@ -36,22 +36,28 @@ using namespace Measure;
PROPERTY_SOURCE(Measure::MeasureLength, Measure::MeasureBase)
MeasureLength::MeasureLength()
{
ADD_PROPERTY_TYPE(Elements,(nullptr), "Measurement", App::Prop_None, "Elements to get the length from");
ADD_PROPERTY_TYPE(Elements,
(nullptr),
"Measurement",
App::Prop_None,
"Elements to get the length from");
Elements.setScope(App::LinkScope::Global);
Elements.setAllowExternal(true);
ADD_PROPERTY_TYPE(Length,(0.0) ,"Measurement",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
"Length of selection");
ADD_PROPERTY_TYPE(Length,
(0.0),
"Measurement",
App::PropertyType(App::Prop_ReadOnly | App::Prop_Output),
"Length of selection");
}
MeasureLength::~MeasureLength() = default;
bool MeasureLength::isValidSelection(const App::MeasureSelection& selection){
bool MeasureLength::isValidSelection(const App::MeasureSelection& selection)
{
if (selection.empty()) {
return false;
@@ -65,14 +71,15 @@ bool MeasureLength::isValidSelection(const App::MeasureSelection& selection){
}
if ((type != App::MeasureElementType::LINESEGMENT && type != App::MeasureElementType::CIRCLE
&& type != App::MeasureElementType::ARC && type != App::MeasureElementType::CURVE)) {
&& type != App::MeasureElementType::ARC && type != App::MeasureElementType::CURVE)) {
return false;
}
}
return true;
}
void MeasureLength::parseSelection(const App::MeasureSelection& selection) {
void MeasureLength::parseSelection(const App::MeasureSelection& selection)
{
// Set properties from selection, method is only invoked when isValid Selection returns true
std::vector<App::DocumentObject*> objects;
@@ -89,7 +96,7 @@ void MeasureLength::parseSelection(const App::MeasureSelection& selection) {
}
App::DocumentObjectExecReturn *MeasureLength::execute()
App::DocumentObjectExecReturn* MeasureLength::execute()
{
recalculateLength();
return DocumentObject::StdReturn;
@@ -103,9 +110,9 @@ void MeasureLength::recalculateLength()
double result(0.0);
// Loop through Elements and call the valid geometry handler
for (std::vector<App::DocumentObject*>::size_type i=0; i<objects.size(); i++) {
for (std::vector<App::DocumentObject*>::size_type i = 0; i < objects.size(); i++) {
App::SubObjectT subject{objects.at(i), subElements.at(i).c_str()};
App::SubObjectT subject {objects.at(i), subElements.at(i).c_str()};
auto info = getMeasureInfo(subject);
if (!info || !info->valid) {
continue;
@@ -132,7 +139,8 @@ void MeasureLength::onChanged(const App::Property* prop)
}
Base::Placement MeasureLength::getPlacement() {
Base::Placement MeasureLength::getPlacement()
{
const std::vector<App::DocumentObject*>& objects = Elements.getValues();
const std::vector<std::string>& subElements = Elements.getSubValues();
@@ -140,7 +148,7 @@ Base::Placement MeasureLength::getPlacement() {
return Base::Placement();
}
App::SubObjectT subject{objects.front(), subElements.front().c_str()};
App::SubObjectT subject {objects.front(), subElements.front().c_str()};
auto info = getMeasureInfo(subject);
if (!info || !info->valid) {
@@ -157,4 +165,3 @@ std::vector<App::DocumentObject*> MeasureLength::getSubject() const
{
return Elements.getValues();
}