Drawing: Apply clang format

This commit is contained in:
wmayer
2023-09-10 12:33:49 +02:00
committed by wwmayer
parent ebcd846d09
commit 789912d745
52 changed files with 2650 additions and 2106 deletions

View File

@@ -22,11 +22,11 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <iomanip>
# include <iterator>
# include <sstream>
#include <iomanip>
#include <iterator>
#include <sstream>
# include <boost/regex.hpp>
#include <boost/regex.hpp>
#endif
#include "FeatureViewSymbol.h"
@@ -42,18 +42,20 @@ using namespace std;
PROPERTY_SOURCE(Drawing::FeatureViewSymbol, Drawing::FeatureView)
FeatureViewSymbol::FeatureViewSymbol(void)
FeatureViewSymbol::FeatureViewSymbol(void)
{
static const char *vgroup = "Drawing view";
ADD_PROPERTY_TYPE(Symbol,(""),vgroup,App::Prop_Hidden,"The SVG code defining this symbol");
ADD_PROPERTY_TYPE(EditableTexts,(""),vgroup,App::Prop_None,"Substitution values for the editable strings in this symbol");
static const char* vgroup = "Drawing view";
ADD_PROPERTY_TYPE(Symbol, (""), vgroup, App::Prop_Hidden, "The SVG code defining this symbol");
ADD_PROPERTY_TYPE(EditableTexts,
(""),
vgroup,
App::Prop_None,
"Substitution values for the editable strings in this symbol");
}
FeatureViewSymbol::~FeatureViewSymbol()
{
}
{}
/// get called by the container when a Property was changed
void FeatureViewSymbol::onChanged(const App::Property* prop)
@@ -63,7 +65,7 @@ void FeatureViewSymbol::onChanged(const App::Property* prop)
std::vector<string> eds;
std::string svg = Symbol.getValue();
if (!svg.empty()) {
boost::regex e ("<text.*?freecad:editable=\"(.*?)\".*?<tspan.*?>(.*?)</tspan>");
boost::regex e("<text.*?freecad:editable=\"(.*?)\".*?<tspan.*?>(.*?)</tspan>");
std::string::const_iterator tbegin, tend;
tbegin = svg.begin();
tend = svg.end();
@@ -79,13 +81,13 @@ void FeatureViewSymbol::onChanged(const App::Property* prop)
Drawing::FeatureView::onChanged(prop);
}
App::DocumentObjectExecReturn *FeatureViewSymbol::execute(void)
App::DocumentObjectExecReturn* FeatureViewSymbol::execute(void)
{
std::string svg = Symbol.getValue();
const std::vector<std::string>& editText = EditableTexts.getValues();
if (!editText.empty()) {
boost::regex e1 ("<text.*?freecad:editable=\"(.*?)\".*?<tspan.*?>(.*?)</tspan>");
boost::regex e1("<text.*?freecad:editable=\"(.*?)\".*?<tspan.*?>(.*?)</tspan>");
string::const_iterator begin, end;
begin = svg.begin();
end = svg.end();
@@ -98,9 +100,14 @@ App::DocumentObjectExecReturn *FeatureViewSymbol::execute(void)
if (count < editText.size()) {
// change values of editable texts. Also strip the "freecad:editable"
// attribute so it isn't detected by the page
boost::regex e2 ("(<text.*?)(freecad:editable=\""+what[1].str()+"\")(.*?<tspan.*?)>(.*?)(</tspan>)");
boost::regex e2("(<text.*?)(freecad:editable=\"" + what[1].str()
+ "\")(.*?<tspan.*?)>(.*?)(</tspan>)");
std::back_insert_iterator<std::string> out(newsvg);
boost::regex_replace(out, begin, what[0].second, e2, "$1$3>"+editText[count]+"$5");
boost::regex_replace(out,
begin,
what[0].second,
e2,
"$1$3>" + editText[count] + "$5");
}
count++;
begin = what[0].second;
@@ -110,13 +117,13 @@ App::DocumentObjectExecReturn *FeatureViewSymbol::execute(void)
newsvg.insert(newsvg.end(), begin, end);
svg = newsvg;
}
std::stringstream result;
result << "<g transform=\"translate(" << X.getValue() << "," << Y.getValue() << ")"
<< " rotate(" << Rotation.getValue() << ")"
<< " scale(" << Scale.getValue() << ")\">" << endl
<< svg << endl
<< "</g>" << endl;
result << "<g transform=\"translate(" << X.getValue() << "," << Y.getValue() << ")"
<< " rotate(" << Rotation.getValue() << ")"
<< " scale(" << Scale.getValue() << ")\">" << endl
<< svg << endl
<< "</g>" << endl;
// Apply the resulting fragment
ViewResult.setValue(result.str().c_str());
@@ -126,14 +133,17 @@ App::DocumentObjectExecReturn *FeatureViewSymbol::execute(void)
// Python Drawing feature ---------------------------------------------------------
namespace App {
namespace App
{
/// @cond DOXERR
PROPERTY_SOURCE_TEMPLATE(Drawing::FeatureViewSymbolPython, Drawing::FeatureViewSymbol)
template<> const char* Drawing::FeatureViewSymbolPython::getViewProviderName(void) const {
template<>
const char* Drawing::FeatureViewSymbolPython::getViewProviderName(void) const
{
return "DrawingGui::ViewProviderDrawingView";
}
/// @endcond
// explicit template instantiation
template class DrawingExport FeaturePythonT<Drawing::FeatureViewSymbol>;
}
}// namespace App