File: pyqwt3d-0.2.7.patch

package info (click to toggle)
pyqwt3d 0.1.8-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 984 kB
  • sloc: python: 3,932; cpp: 328; makefile: 113; sh: 7
file content (205 lines) | stat: -rw-r--r-- 6,418 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
--- qwtplot3d-0.2.7/include/qwt3d_global.h.pyqwt3d Tue Aug  7 19:50:24 2007
+++ qwtplot3d-0.2.7/include/qwt3d_global.h Tue Aug  7 19:50:24 2007
@@ -8,7 +8,7 @@
 
 #define QWT3D_MAJOR_VERSION 0
 #define QWT3D_MINOR_VERSION 2
-#define QWT3D_PATCH_VERSION 6
+#define QWT3D_PATCH_VERSION 7
 
 //
 // Create Qwt3d DLL if QWT3D_DLL is defined (Windows only)
--- qwtplot3d-0.2.7/src/qwt3d_io.cpp.pyqwt3d Tue Aug  7 19:50:24 2007
+++ qwtplot3d-0.2.7/src/qwt3d_io.cpp Tue Aug  7 19:50:24 2007
@@ -302,6 +302,14 @@
 #endif
   vecfunc.setFormat("PDF");
   defineOutputHandler("PDF", vecfunc);
+  vecfunc.setFormat("SVG");
+  defineOutputHandler("SVG", vecfunc);
+  vecfunc.setFormat("PGF");
+  defineOutputHandler("PGF", vecfunc);
+#ifdef GL2PS_HAVE_ZLIB
+  vecfunc.setFormat("SVG_GZ");
+  defineOutputHandler("SVG_GZ", vecfunc);
+#endif
 
   defineInputHandler("mes", NativeReader());
   defineInputHandler("MES", NativeReader());
@@ -310,21 +318,22 @@
 /*!
   \deprecated  Use Plot3D::save or IO::save instead.
   
-  Writes vector data supported by gl2ps. The corresponding format types are "EPS","PS"or "PDF".
-  If zlib has been configured this will be extended by "EPS_GZ" and "PS_GZ". 
+  Writes vector data supported by gl2ps. The corresponding format types are "EPS","PS", "PDF", "SVG", or "PGF".
+  If zlib has been configured this will be extended by "EPS_GZ", "PS_GZ" and "SVG_GZ". 
   \b Beware: BSPSORT turns out to behave very slowly and memory consuming, especially in cases where
   many polygons appear. It is still more exact than SIMPLESORT.
 */
-bool Plot3D::saveVector(QString const& fileName, QString const& format, VectorWriter::TEXTMODE text, VectorWriter::SORTMODE sortmode)
+bool Plot3D::saveVector(QString const& fileName, QString const& format, VectorWriter::TEXTMODE textmode, VectorWriter::SORTMODE sortmode)
 {
   if (format == "EPS" || format == "EPS_GZ" || format == "PS" 
-    || format == "PS_GZ" || format == "PDF")
+      || format == "PS_GZ" || format == "PDF" || format == "SVG"
+      || format == "SVG_GZ" || format == "PGF")
   {  
     VectorWriter* gl2ps = (VectorWriter*)IO::outputHandler(format);
     if (gl2ps)
     {
       gl2ps->setSortMode(sortmode);
-      gl2ps->setTextMode(text);
+      gl2ps->setTextMode(textmode);
     }
     return IO::save(this, fileName, format);
   }
@@ -338,7 +347,8 @@
 bool Plot3D::savePixmap(QString const& fileName, QString const& format)
 {
   if (format == "EPS" || format == "EPS_GZ" || format == "PS" 
-    || format == "PS_GZ" || format == "PDF")
+      || format == "PS_GZ" || format == "PDF" || format == "SVG"
+      || format == "SVG_GZ" || format == "PGF")
     return false;
   
   return IO::save(this, fileName, format);
--- qwtplot3d-0.2.7/src/qwt3d_io_gl2ps.cpp.pyqwt3d Tue Aug  7 19:50:24 2007
+++ qwtplot3d-0.2.7/src/qwt3d_io_gl2ps.cpp Tue Aug  7 19:50:24 2007
@@ -68,8 +68,8 @@
 
 
 /*! 
-Set output format, must be one of "EPS_GZ", "PS_GZ", "EPS", 
-"PS", "PDF" (case sensitive)
+Set output format, must be one of "EPS_GZ", "PS_GZ", "SVG_GZ", "EPS", 
+"PS", "PDF", "SVG", or "PGF" (case sensitive)
 */
 bool VectorWriter::setFormat(QString const& format)
 {
@@ -95,6 +95,20 @@
     gl2ps_format_ = GL2PS_PS;
   }
 #endif
+  else if (format == QString("SVG"))
+  {
+    gl2ps_format_ = GL2PS_SVG;
+  }
+#ifdef GL2PS_HAVE_ZLIB
+  else if (format == QString("SVG_GZ"))
+  {
+    gl2ps_format_ = GL2PS_SVG;
+  }
+#endif
+  else if (format == QString("PGF"))
+  {
+    gl2ps_format_ = GL2PS_PGF;
+  }
   else
   {
     formaterror_ = true;
@@ -104,9 +118,20 @@
   return true;
 }
 
+#include <locale.h>
+class CLocale {
+public:
+  CLocale() { old = setlocale(LC_ALL, "C"); }
+  ~CLocale() { setlocale(LC_ALL, old); }
+private:
+  char *old;
+};
+
 //! Performs actual output
 bool VectorWriter::operator()(Plot3D* plot, QString const& fname)
 {
+  CLocale();
+
   if (formaterror_)
     return false;
 
@@ -174,7 +199,7 @@
     + QString::number(QWT3D_PATCH_VERSION); 
       
   QString producer = QString("QwtPlot3D ") + version + 
-    " (beta) , (C) 2002";
+    ", (C) 2002";
 
   // calculate actual year
   time_t now;
@@ -184,7 +209,8 @@
   if (newtime && newtime->tm_year + 1900 > 2002)
     producer += "-" + QString::number(newtime->tm_year+1900); 
 
-  producer += " Micha Bieber <krischnamurti@users.sourceforge.net>";
+  // the SVG format does not like some of the characters in a mail address
+  producer += " Micha Bieber, mailto: krischnamurti at users.sourceforge.net";
 
   FILE *fp = fopen(QWT3DLOCAL8BIT(fname), "wb");  
   if (!fp)
@@ -195,7 +221,7 @@
   while( state == GL2PS_OVERFLOW )
   { 
     bufsize += 2*1024*1024;
-    gl2psBeginPage ( "---", QWT3DLOCAL8BIT(producer), viewport,
+    gl2psBeginPage ( QWT3DLOCAL8BIT(fname), QWT3DLOCAL8BIT(producer), viewport,
                      gl2ps_format_, sortmode,
                      options, GL_RGBA, 0, NULL, 0, 0, 0, bufsize,
                      fp, QWT3DLOCAL8BIT(fname) );
@@ -225,7 +251,7 @@
     while( state == GL2PS_OVERFLOW )
     { 
       bufsize += 2*1024*1024;
-      gl2psBeginPage ( "---", QWT3DLOCAL8BIT(producer), viewport,
+      gl2psBeginPage ( QWT3DLOCAL8BIT(fname), QWT3DLOCAL8BIT(producer), viewport,
         GL2PS_TEX, sortmode,
         options, GL_RGBA, 0, NULL, 0, 0, 0, bufsize,
         fp, QWT3DLOCAL8BIT(fn) );
--- qwtplot3d-0.2.7/src/qwt3d_label.cpp.pyqwt3d Tue Aug  7 19:50:24 2007
+++ qwtplot3d-0.2.7/src/qwt3d_label.cpp Tue Aug  7 20:15:42 2007
@@ -121,6 +121,29 @@
   }
   
   QBitmap bm(pm_.width(),pm_.height());
+
+#if QT_VERSION >= 0x040000 && defined(Q_WS_X11)
+  bm.fill(Qt::white);
+  p.begin( &bm );
+    p.setPen(Qt::black);
+    p.setFont(font_);
+    p.drawText(0,r.height() - fm.descent() -1 , text_);
+  p.end();
+
+  pm_.setMask(bm);
+  
+  // avoids uninitialized areas in some cases
+  pm_.fill(Qt::white);
+  p.begin( &pm_ );
+    p.setFont( font_ );
+    p.setPen( Qt::SolidLine );
+    p.setPen( GL2Qt(color.r, color.g, color.b) );
+
+    p.drawText(0,r.height() - fm.descent() -1 , text_);
+  p.end();
+
+  buf_ = pm_.toImage();
+#else
   bm.fill(Qt::color0);
   p.begin( &bm );
     p.setPen(Qt::color1);
@@ -141,11 +164,14 @@
 
     p.drawText(0,r.height() - fm.descent() -1 , text_);
   p.end();
+#endif
+
 #if QT_VERSION < 0x040000
   buf_ = pm_.convertToImage();
 #else
   buf_ = pm_.toImage();
 #endif
+
   tex_ = QGLWidget::convertToGLFormat( buf_ );    // flipped 32bit RGBA ?   
 }