Commit fdc1c377 authored by Tiago Peixoto's avatar Tiago Peixoto

PropertyMap: assure that filtered arrays (fa) have always the correct size

This closes issue #228
parent 06157bcc
......@@ -552,8 +552,10 @@ class PropertyMap(object):
filt = [None]
if self.__key_type == 'v':
filt = g.get_vertex_filter()
N = g.num_vertices()
elif self.__key_type == 'e':
filt = g.get_edge_filter()
N = g._get_max_edge_index()
if g.get_vertex_filter()[0] is not None:
filt = (g.new_edge_property("bool"), filt[1])
u = GraphView(g, directed=True, skip_properties=True)
......@@ -569,7 +571,7 @@ class PropertyMap(object):
return a
if filt[0] is None:
return a
return a[filt[0].a == (not filt[1])]
return a[filt[0].a == (not filt[1])][:N]
else:
if a is None:
return
......@@ -580,6 +582,7 @@ class PropertyMap(object):
a[:] = v[:len(a)]
else:
m = filt[0].a == (not filt[1])
m *= m.cumsum() <= N
try:
a[m] = v
except ValueError:
......
......@@ -1137,7 +1137,7 @@ def scale_ink(scale, vprops, eprops):
def get_bb(g, pos, size, pen_width, size_scale=1, text=None, font_family=None,
font_size=None, cr=None):
size = size.fa[:g.num_vertices()] if isinstance(size, PropertyMap) else size
size = size.fa if isinstance(size, PropertyMap) else size
pen_width = pen_width.fa if isinstance(pen_width, PropertyMap) else pen_width
pos_x, pos_y = ungroup_vector_property(pos, [0, 1])
if text is not None and text != "":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment