diff --git a/Rendering/GL2PS/vtkGL2PSContextDevice2D.cxx b/Rendering/GL2PS/vtkGL2PSContextDevice2D.cxx index 2d8a2c6172258186146697af339d67b386b59451..429726eb78c54a5c1b817470faff31b141f72bc0 100644 --- a/Rendering/GL2PS/vtkGL2PSContextDevice2D.cxx +++ b/Rendering/GL2PS/vtkGL2PSContextDevice2D.cxx @@ -30,6 +30,8 @@ #include "vtk_gl2ps.h" +#include + //----------------------------------------------------------------------------- vtkStandardNewMacro(vtkGL2PSContextDevice2D) @@ -164,7 +166,14 @@ void vtkGL2PSContextDevice2D::DrawEllipseWedge(float x, float y, unsigned char color[4]; this->Brush->GetColor(color); - vtkGL2PSUtilities::DrawPath(path.GetPointer(), origin, origin, color); + std::stringstream label; + label << "vtkGL2PSContextDevice2D::DrawEllipseWedge(" + << x << ", " << y << ", " << outRx << ", " << outRy << ", " + << inRx << ", " << inRy << ", " << startAngle << ", " << stopAngle + << ") path:"; + + vtkGL2PSUtilities::DrawPath(path.GetPointer(), origin, origin, color, NULL, + 0.0, -1.f, label.str().c_str()); } //----------------------------------------------------------------------------- @@ -194,14 +203,27 @@ void vtkGL2PSContextDevice2D::DrawEllipticArc(float x, float y, // Fill unsigned char fillColor[4]; this->Brush->GetColor(fillColor); - vtkGL2PSUtilities::DrawPath(path.GetPointer(), origin, origin, fillColor); + + std::stringstream label; + label << "vtkGL2PSContextDevice2D::DrawEllipticArc(" + << x << ", " << y << ", " << rx << ", " << ry << ", " + << startAngle << ", " << stopAngle << ") fill:"; + + vtkGL2PSUtilities::DrawPath(path.GetPointer(), origin, origin, fillColor, + NULL, 0.0, -1.f, label.str().c_str()); // and stroke unsigned char strokeColor[4]; this->Pen->GetColor(strokeColor); float strokeWidth = this->Pen->GetWidth(); + + label.str(""); + label.clear(); + label << "vtkGL2PSContextDevice2D::DrawEllipticArc(" + << x << ", " << y << ", " << rx << ", " << ry << ", " + << startAngle << ", " << stopAngle << ") stroke:"; vtkGL2PSUtilities::DrawPath(path.GetPointer(), origin, origin, strokeColor, - NULL, 0.0, strokeWidth); + NULL, 0.0, strokeWidth, label.str().c_str()); } //----------------------------------------------------------------------------- @@ -220,6 +242,7 @@ void vtkGL2PSContextDevice2D::DrawString(float *point, vtkGL2PSUtilities::DrawString(string.utf8_str(), this->TextProp, p); } +//----------------------------------------------------------------------------- void vtkGL2PSContextDevice2D::DrawMathTextString(float apoint[], const vtkStdString &string) { @@ -256,7 +279,8 @@ void vtkGL2PSContextDevice2D::DrawMathTextString(float apoint[], this->TransformPath(path.GetPointer()); vtkGL2PSUtilities::DrawPath(path.GetPointer(), origin, origin, color, NULL, - rotateAngle); + rotateAngle, -1.f, + ("Pathified string: " + string).c_str()); } //----------------------------------------------------------------------------- diff --git a/Rendering/GL2PS/vtkGL2PSUtilities.cxx b/Rendering/GL2PS/vtkGL2PSUtilities.cxx index 7e14284f1dca05db01ce8e343157009f52f91172..685b28871a0c3b5ffd5d4b0f237941308b6808bc 100644 --- a/Rendering/GL2PS/vtkGL2PSUtilities.cxx +++ b/Rendering/GL2PS/vtkGL2PSUtilities.cxx @@ -94,7 +94,9 @@ void vtkGL2PSUtilities::DrawString(const char *str, double devicePos[3] = {pos[0], pos[1], pos[2]}; vtkGL2PSUtilities::ProjectPoint(devicePos); - vtkGL2PSUtilities::DrawPath(path.GetPointer(), pos, devicePos, rgba); + vtkGL2PSUtilities::DrawPath(path.GetPointer(), pos, devicePos, rgba, NULL, + 0.0, -1.f, (std::string("Pathified string: ") + + str).c_str()); } } @@ -236,35 +238,36 @@ int vtkGL2PSUtilities::TextPropertyToGL2PSAlignment(vtkTextProperty *tprop) void vtkGL2PSUtilities::Draw3DPath(vtkPath *path, vtkMatrix4x4 *actorMatrix, double rasterPos[3], - unsigned char actorColor[4]) + unsigned char actorColor[4], + const char *label) { double translation[2] = {0.0, 0.0}; vtkNew projPath; projPath->DeepCopy(path); vtkGL2PSUtilities::ProjectPoints(projPath->GetPoints(), actorMatrix); vtkGL2PSUtilities::DrawPath(projPath.GetPointer(), rasterPos, translation, - actorColor); + actorColor, NULL, 0.0, -1.f, label); } void vtkGL2PSUtilities::DrawPath(vtkPath *path, double rasterPos[3], double windowPos[2], unsigned char rgba[4], double scale[2], double rotateAngle, - float strokeWidth) + float strokeWidth, const char *label) { switch (gl2psGetFileFormat()) { case GL2PS_PS: case GL2PS_EPS: vtkGL2PSUtilities::DrawPathPS(path, rasterPos, windowPos, rgba, scale, - rotateAngle, strokeWidth); + rotateAngle, strokeWidth, label); break; case GL2PS_SVG: vtkGL2PSUtilities::DrawPathSVG(path, rasterPos, windowPos, rgba, scale, - rotateAngle, strokeWidth); + rotateAngle, strokeWidth, label); break; case GL2PS_PDF: vtkGL2PSUtilities::DrawPathPDF(path, rasterPos, windowPos, rgba, scale, - rotateAngle, strokeWidth); + rotateAngle, strokeWidth, label); break; default: break; @@ -302,7 +305,7 @@ void vtkGL2PSUtilities::FinishExport() void vtkGL2PSUtilities::DrawPathPS(vtkPath *path, double rasterPos[3], double windowPos[2], unsigned char rgba[4], double scale[2], double rotateAngle, - float strokeWidth) + float strokeWidth, const char *label) { vtkFloatArray *points = vtkFloatArray::SafeDownCast(path->GetPoints()->GetData()); @@ -334,6 +337,10 @@ void vtkGL2PSUtilities::DrawPathPS(vtkPath *path, double rasterPos[3], int *codeBegin = code; #endif int *codeEnd = code + codes->GetNumberOfTuples(); + if (label != NULL && label[0] != '\0') + { + out << "% " << label << endl; + } out << "gsave" << endl; out << "initmatrix" << endl; out << windowPos[0] << " " << windowPos[1] << " translate" << endl; @@ -435,7 +442,8 @@ void vtkGL2PSUtilities::DrawPathPS(vtkPath *path, double rasterPos[3], void vtkGL2PSUtilities::DrawPathPDF(vtkPath *path, double rasterPos[3], double windowPos[2], unsigned char rgba[4], double scale[2], double rotateAngle, - float strokeWidth) + float strokeWidth, + const char *) { vtkFloatArray *points = vtkFloatArray::SafeDownCast(path->GetPoints()->GetData()); @@ -583,7 +591,7 @@ void vtkGL2PSUtilities::DrawPathPDF(vtkPath *path, double rasterPos[3], void vtkGL2PSUtilities::DrawPathSVG(vtkPath *path, double rasterPos[3], double windowPos[2], unsigned char rgba[4], double scale[2], double rotateAngle, - float strokeWidth) + float strokeWidth, const char *label) { vtkFloatArray *points = vtkFloatArray::SafeDownCast(path->GetPoints()->GetData()); @@ -625,6 +633,12 @@ void vtkGL2PSUtilities::DrawPathSVG(vtkPath *path, double rasterPos[3], float *ptBegin = pt; int *codeBegin = code; #endif + + if (label != NULL && label[0] != '\0') + { + out << "" << endl; + } + int *codeEnd = code + codes->GetNumberOfTuples(); out << "