Drawing: Apply clang format
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <iomanip>
|
||||
# include <sstream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#include "FeatureViewAnnotation.h"
|
||||
@@ -39,36 +39,39 @@ using namespace std;
|
||||
PROPERTY_SOURCE(Drawing::FeatureViewAnnotation, Drawing::FeatureView)
|
||||
|
||||
|
||||
FeatureViewAnnotation::FeatureViewAnnotation(void)
|
||||
FeatureViewAnnotation::FeatureViewAnnotation(void)
|
||||
{
|
||||
static const char *vgroup = "Drawing view";
|
||||
static const char* vgroup = "Drawing view";
|
||||
|
||||
ADD_PROPERTY_TYPE(Text ,(""),vgroup,App::Prop_None,"The text to be displayed");
|
||||
ADD_PROPERTY_TYPE(Font ,("Sans"),vgroup,App::Prop_None,"The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(TextColor, (0.0f, 0.0f, 0.0f), vgroup, App::Prop_None,
|
||||
ADD_PROPERTY_TYPE(Text, (""), vgroup, App::Prop_None, "The text to be displayed");
|
||||
ADD_PROPERTY_TYPE(Font, ("Sans"), vgroup, App::Prop_None, "The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(TextColor,
|
||||
(0.0f, 0.0f, 0.0f),
|
||||
vgroup,
|
||||
App::Prop_None,
|
||||
"The color of the text");
|
||||
}
|
||||
|
||||
FeatureViewAnnotation::~FeatureViewAnnotation()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
App::DocumentObjectExecReturn *FeatureViewAnnotation::execute(void)
|
||||
App::DocumentObjectExecReturn* FeatureViewAnnotation::execute(void)
|
||||
{
|
||||
stringstream result,hr,hg,hb;
|
||||
stringstream result, hr, hg, hb;
|
||||
const App::Color& c = TextColor.getValue();
|
||||
hr << hex << setfill('0') << setw(2) << (int)(255.0*c.r);
|
||||
hg << hex << setfill('0') << setw(2) << (int)(255.0*c.g);
|
||||
hb << hex << setfill('0') << setw(2) << (int)(255.0*c.b);
|
||||
hr << hex << setfill('0') << setw(2) << (int)(255.0 * c.r);
|
||||
hg << hex << setfill('0') << setw(2) << (int)(255.0 * c.g);
|
||||
hb << hex << setfill('0') << setw(2) << (int)(255.0 * c.b);
|
||||
|
||||
result << "<g transform=\"translate(" << X.getValue() << "," << Y.getValue() << ")"
|
||||
<< " rotate(" << Rotation.getValue() << ")\">" << endl
|
||||
<< "<text id=\"" << Label.getValue() << "\"" << endl
|
||||
<< " font-family=\"" << Font.getValue() << "\"" << endl
|
||||
<< " font-size=\"" << Scale.getValue() << "\"" << endl
|
||||
<< " fill=\"#" << hr.str() << hg.str() << hb.str() << "\">" << endl;
|
||||
result << "<g transform=\"translate(" << X.getValue() << "," << Y.getValue() << ")"
|
||||
<< " rotate(" << Rotation.getValue() << ")\">" << endl
|
||||
<< "<text id=\"" << Label.getValue() << "\"" << endl
|
||||
<< " font-family=\"" << Font.getValue() << "\"" << endl
|
||||
<< " font-size=\"" << Scale.getValue() << "\"" << endl
|
||||
<< " fill=\"#" << hr.str() << hg.str() << hb.str() << "\">" << endl;
|
||||
|
||||
for (vector<string>::const_iterator it = Text.getValues().begin(); it != Text.getValues().end(); ++it) {
|
||||
for (vector<string>::const_iterator it = Text.getValues().begin(); it != Text.getValues().end();
|
||||
++it) {
|
||||
result << "<tspan x=\"0\" dy=\"1em\">" << it->c_str() << "</tspan>" << endl;
|
||||
}
|
||||
|
||||
@@ -82,14 +85,17 @@ App::DocumentObjectExecReturn *FeatureViewAnnotation::execute(void)
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
namespace App {
|
||||
namespace App
|
||||
{
|
||||
/// @cond DOXERR
|
||||
PROPERTY_SOURCE_TEMPLATE(Drawing::FeatureViewAnnotationPython, Drawing::FeatureViewAnnotation)
|
||||
template<> const char* Drawing::FeatureViewAnnotationPython::getViewProviderName(void) const {
|
||||
template<>
|
||||
const char* Drawing::FeatureViewAnnotationPython::getViewProviderName(void) const
|
||||
{
|
||||
return "DrawingGui::ViewProviderDrawingView";
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingExport FeaturePythonT<Drawing::FeatureViewAnnotation>;
|
||||
}
|
||||
}// namespace App
|
||||
|
||||
Reference in New Issue
Block a user