Refined Drawing::FeatureViewAnnotation

+ Now goes inside an existing page automatically
+ Supports Rotation value
This commit is contained in:
Yorik van Havre
2012-05-03 16:04:48 -03:00
parent 95922640a0
commit d4b5a079d9
2 changed files with 22 additions and 8 deletions

View File

@@ -66,21 +66,20 @@ App::DocumentObjectExecReturn *FeatureViewAnnotation::execute(void)
hg << hex << setfill('0') << setw(2) << (int)(255.0*c.g);
hb << hex << setfill('0') << setw(2) << (int)(255.0*c.b);
result << "<text"
<< " id=\"" << Label.getValue() << "\"" << endl
<< " x=\"" << X.getValue() << "\"" << endl
<< " y=\"" << Y.getValue() << "\"" << 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;
int index=0;
for (std::vector<std::string>::const_iterator it = Text.getValues().begin(); it != Text.getValues().end(); ++it) {
result << "<tspan x=\"" << X.getValue() << "\" dy=\"1em\">" << it->c_str() << "</tspan>" << endl;
result << "<tspan x=\"0\" dy=\"1em\">" << it->c_str() << "</tspan>" << endl;
index++;
}
result << "</text>" << endl;
result << "</text>" << endl << "</g>" << endl;
// Apply the resulting fragment
ViewResult.setValue(result.str().c_str());