Skip to content

Commit

Permalink
Apply different styling for node and feature vertices
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 14, 2019
1 parent 8ae96ed commit c36a674
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions earthsim/annotators.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ class GeoAnnotator(param.Parameterized):
points = param.ClassSelector(class_=Points, precedence=-1, doc="""
Point element to annotate""")

node_style = param.Dict(default={'fill_color': 'indianred', 'size': 6}, doc="""
Styling to apply to the node vertices.""")

feature_style = param.Dict(default={'fill_color': 'blue', 'size': 10}, doc="""
Styling to apply to the feature vertices.""")

height = param.Integer(default=500, doc="Height of the plot",
precedence=-1)

Expand All @@ -153,10 +159,14 @@ def __init__(self, polys=None, points=None, crs=None, **params):
self.polys = polys.options(**opts)
if isinstance(self.polys, Polygons):
poly_draw, poly_edit = PolyDraw, PolyEdit
style_kwargs = {}
else:
poly_draw, poly_edit = PolyVertexDraw, PolyVertexEdit
self.poly_stream = poly_draw(source=self.polys, data={}, show_vertices=True)
self.vertex_stream = poly_edit(source=self.polys, vertex_style={'nonselection_alpha': 0.5})
style_kwargs = dict(node_style=self.node_style, feature_style=self.feature_style)
self.poly_stream = poly_draw(source=self.polys, data={}, show_vertices=True,
**style_kwargs)
self.vertex_stream = poly_edit(source=self.polys, vertex_style={'nonselection_alpha': 0.5},
**style_kwargs)
if isinstance(points, Points):
self.points = points
else:
Expand Down

0 comments on commit c36a674

Please sign in to comment.