9
10
# Enthought library imports
10
11
from enthought.enable.api import black_color_trait, ColorTrait, AbstractMarker, \
11
12
CustomMarker, MarkerNameDict, MarkerTrait
12
from enthought.kiva import STROKE
13
from enthought.kiva.constants import STROKE
13
14
from enthought.traits.api import Any, Array, Bool, Float, Int, Trait, Callable
14
15
from enthought.traits.ui.api import View, VGroup, Item
75
76
elif issubclass(marker, AbstractMarker):
80
gc.set_line_dash(None)
81
if marker.draw_mode == STROKE:
82
# markers with the STROKE draw mode will not be visible
83
# if the line width is zero, so set it to 1
86
gc.set_stroke_color(color)
87
gc.set_line_width(line_width)
89
gc.set_stroke_color(outline_color)
90
gc.set_line_width(line_width)
91
gc.set_fill_color(color)
95
# This is the fastest method - use one of the kiva built-in markers
96
if (not debug) and hasattr(gc, "draw_marker_at_points") \
97
and (marker.__class__ != CustomMarker) \
98
and (gc.draw_marker_at_points(points,
100
marker.kiva_marker) != 0):
103
# The second fastest method - draw the path into a compiled path, then
104
# draw the compiled path at each point
105
elif hasattr(gc, 'draw_path_at_points'):
107
# import pdb; pdb.set_trace()
108
if marker.__class__ != CustomMarker:
109
path = gc.get_empty_path()
110
marker.add_to_path(path, marker_size)
111
mode = marker.draw_mode
115
if not marker.antialias:
116
gc.set_antialias(False)
117
gc.draw_path_at_points(points, path, mode)
119
# Neither of the fast functions worked, so use the brute-force, manual way
121
if not marker.antialias:
122
gc.set_antialias(False)
123
if marker.__class__ != CustomMarker:
126
gc.translate_ctm(sx, sy)
127
# Kiva GCs have a path-drawing interface
128
marker.add_to_path(gc, marker_size)
129
gc.draw_path(marker.draw_mode)
135
gc.translate_ctm(sx, sy)
80
gc.set_line_dash(None)
81
if marker.draw_mode == STROKE:
82
# markers with the STROKE draw mode will not be visible
83
# if the line width is zero, so set it to 1
86
gc.set_stroke_color(color)
87
gc.set_line_width(line_width)
89
gc.set_stroke_color(outline_color)
90
gc.set_line_width(line_width)
91
gc.set_fill_color(color)
95
# This is the fastest method - use one of the kiva built-in markers
96
if (not debug) and hasattr(gc, "draw_marker_at_points") \
97
and (marker.__class__ != CustomMarker) \
98
and (gc.draw_marker_at_points(points,
100
marker.kiva_marker) != 0):
103
# The second fastest method - draw the path into a compiled path, then
104
# draw the compiled path at each point
105
elif hasattr(gc, 'draw_path_at_points'):
107
# import pdb; pdb.set_trace()
108
if marker.__class__ != CustomMarker:
109
path = gc.get_empty_path()
110
marker.add_to_path(path, marker_size)
111
mode = marker.draw_mode
115
if not marker.antialias:
116
gc.set_antialias(False)
117
gc.draw_path_at_points(points, path, mode)
119
# Neither of the fast functions worked, so use the brute-force, manual way
121
if not marker.antialias:
122
gc.set_antialias(False)
123
if marker.__class__ != CustomMarker:
126
gc.translate_ctm(sx, sy)
128
# Kiva GCs have a path-drawing interface
129
marker.add_to_path(gc, marker_size)
130
gc.draw_path(marker.draw_mode)
131
gc.translate_ctm(-sx, -sy)
136
gc.translate_ctm(sx, sy)
140
gc.translate_ctm(-sx, -sy)
144
144
#------------------------------------------------------------------------------
458
460
self.color_, self.line_width, self.outline_color_,
459
461
self.custom_symbol)
461
if self._cached_selected_pts is not None and len(self._cached_selected_pts) > 0:
463
if self.show_selection and self._cached_selected_pts is not None and len(self._cached_selected_pts) > 0:
462
464
sel_pts = self.map_screen(self._cached_selected_pts)
463
465
self.render_markers_func(gc, sel_pts, self.selection_marker,
464
466
self.selection_marker_size, self.selection_color_,