@@ -310,9 +310,9 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
310
310
311
311
if rgbFace :
312
312
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 ]
314
314
else :
315
- ps_color = '%1.3f %1.3f %1.3f setrgbcolor\n ' % rgbFace
315
+ ps_color = '%1.3f %1.3f %1.3f setrgbcolor' % rgbFace
316
316
317
317
if transform .need_nonlinear ():
318
318
x ,y = transform .nonlinear_only_numerix (x , y )
@@ -329,10 +329,12 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
329
329
# construct the generic marker command:
330
330
ps_cmd = ['gsave' ]
331
331
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' )
333
334
while 1 :
334
335
code , xp , yp = path .vertex ()
335
336
if code == agg .path_cmd_stop :
337
+ ps_cmd .append ('closepath' ) # Hack, path_cmd_end_poly not found
336
338
break
337
339
elif code == agg .path_cmd_move_to :
338
340
ps_cmd .append ('%1.3f %1.3f m' % (xp ,yp ))
@@ -343,7 +345,8 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
343
345
elif code == agg .path_cmd_curve4 :
344
346
pass
345
347
elif code == agg .path_cmd_end_poly :
346
- ps_cmd .append ('closepath' % (xp ,yp ))
348
+ pass
349
+ ps_cmd .append ('closepath' )
347
350
elif code == agg .path_cmd_mask :
348
351
pass
349
352
else : print code
@@ -354,12 +357,28 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
354
357
ps_cmd .append ('grestore' )
355
358
ps_cmd .append ('stroke' )
356
359
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 ' ]))
358
363
359
364
# 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
363
382
364
383
def _draw_lines (self , gc , points ):
365
384
"""
@@ -385,12 +404,10 @@ def draw_lines(self, gc, x, y, transform=None):
385
404
start = 0
386
405
end = 1000
387
406
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 ])
394
411
self ._draw_ps ("\n " .join (ps ), gc , None )
395
412
start = end
396
413
end += 1000
0 commit comments