@@ -310,9 +310,9 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
310310
311311 if rgbFace :
312312 if rgbFace [0 ]== rgbFace [0 ] and rgbFace [0 ]== rgbFace [2 ]:
313- ps_color = '%1.3f setgray\n ' % rgbFace [0 ]
313+ ps_color = '%1.3f setgray' % rgbFace [0 ]
314314 else :
315- ps_color = '%1.3f %1.3f %1.3f setrgbcolor\n ' % rgbFace
315+ ps_color = '%1.3f %1.3f %1.3f setrgbcolor' % rgbFace
316316
317317 if transform .need_nonlinear ():
318318 x ,y = transform .nonlinear_only_numerix (x , y )
@@ -329,10 +329,12 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
329329 # construct the generic marker command:
330330 ps_cmd = ['gsave' ]
331331 ps_cmd .append ('newpath' )
332- ps_cmd .append ('%1.3f %1.3f translate' )
332+ ## ps_cmd.append('%1.3f %1.3f translate')
333+ ps_cmd .append ('translate' )
333334 while 1 :
334335 code , xp , yp = path .vertex ()
335336 if code == agg .path_cmd_stop :
337+ ps_cmd .append ('closepath' ) # Hack, path_cmd_end_poly not found
336338 break
337339 elif code == agg .path_cmd_move_to :
338340 ps_cmd .append ('%1.3f %1.3f m' % (xp ,yp ))
@@ -343,7 +345,8 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
343345 elif code == agg .path_cmd_curve4 :
344346 pass
345347 elif code == agg .path_cmd_end_poly :
346- ps_cmd .append ('closepath' % (xp ,yp ))
348+ pass
349+ ps_cmd .append ('closepath' )
347350 elif code == agg .path_cmd_mask :
348351 pass
349352 else : print code
@@ -354,12 +357,28 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
354357 ps_cmd .append ('grestore' )
355358 ps_cmd .append ('stroke' )
356359 ps_cmd .append ('grestore' ) # undo translate()
357- ps = '\n ' .join (ps_cmd )
360+ ps_cmd = '\n ' .join (ps_cmd )
361+
362+ self ._pswriter .write (' ' .join (['/marker {' , ps_cmd , '} bind def\n ' ]))
358363
359364 # Now evaluate the marker command at each marker location:
360- draw_ps = self ._draw_ps
361- for xp ,yp in izip (x ,y ):
362- draw_ps (ps % (xp ,yp ), gc , None )
365+ ## points = zip(x,y)
366+ start = 0
367+ end = 1000
368+ while start < len (x ):
369+ to_draw = izip (x [start :end ],y [start :end ])
370+ ## ps = [ps_cmd % point for point in to_draw]
371+ ps = ['%1.3f %1.3f marker' % point for point in to_draw ]
372+ self ._draw_ps ("\n " .join (ps ), gc , None )
373+ start = end
374+ end += 1000
375+
376+ ## draw_ps = self._draw_ps
377+ ## for xp,yp in izip(x,y):
378+ ## draw_ps(ps_cmd % (xp,yp), gc, None)
379+
380+ def draw_path (self ,gc ,rgbFace ,path ,trans ):
381+ pass
363382
364383 def _draw_lines (self , gc , points ):
365384 """
@@ -385,12 +404,10 @@ def draw_lines(self, gc, x, y, transform=None):
385404 start = 0
386405 end = 1000
387406 points = zip (x ,y )
388- while 1 :
389- to_draw = points [start :end ]
390- if not to_draw :
391- break
392- ps = ["%1.3f %1.3f m" % to_draw [0 ]]
393- ps .extend (["%1.3f %1.3f l" % point for point in to_draw [1 :]])
407+ while start < len (x ):
408+ to_draw = izip (x [start :end ],y [start :end ])
409+ ps = ["%1.3f %1.3f m" % to_draw .next ()]
410+ ps .extend (["%1.3f %1.3f l" % point for point in to_draw ])
394411 self ._draw_ps ("\n " .join (ps ), gc , None )
395412 start = end
396413 end += 1000
0 commit comments