Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9be017c

Browse filesBrowse files
committed
comitting stuff
1 parent 9635bc0 commit 9be017c
Copy full SHA for 9be017c

File tree

2 files changed

+22
-21
lines changed
Filter options

2 files changed

+22
-21
lines changed

‎fastplotlib/graphics/_base.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/_base.py
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from pygfx import WorldObject
1111

12-
from ._features import GraphicFeature, PresentFeature, GraphicFeatureIndexable, Deleted
12+
from ._features import GraphicFeature, PresentFeature, BufferManager, GraphicFeatureDescriptor, Deleted
1313

1414

1515
HexStr: TypeAlias = str
@@ -49,12 +49,15 @@ def __init_subclass__(cls, **kwargs):
4949

5050

5151
class Graphic(BaseGraphic):
52-
feature_events = {}
52+
features = {}
5353

5454
def __init_subclass__(cls, **kwargs):
5555
super().__init_subclass__(**kwargs)
5656
# all graphics give off a feature event when deleted
57-
cls.feature_events = {*cls.feature_events, "deleted"}
57+
cls.features = {*cls.features}#, "deleted"}
58+
59+
for f in cls.features:
60+
setattr(cls, f, GraphicFeatureDescriptor(f))
5861

5962
def __init__(
6063
self,
@@ -80,12 +83,12 @@ def __init__(
8083
self.metadata = metadata
8184
self.collection_index = collection_index
8285
self.registered_callbacks = dict()
83-
self.present = PresentFeature(parent=self)
86+
# self.present = PresentFeature(parent=self)
8487

8588
# store hex id str of Graphic instance mem location
8689
self._fpl_address: HexStr = hex(id(self))
8790

88-
self.deleted = Deleted(self, False)
91+
# self.deleted = Deleted(self, False)
8992

9093
self._plot_area = None
9194

‎fastplotlib/graphics/line.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/line.py
+14-16Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
from ..utils import parse_cmap_values
99
from ._base import Graphic, Interaction, PreviouslyModifiedData
10-
from ._features import PointsDataFeature, ColorFeature, CmapFeature, ThicknessFeature
10+
from ._features import GraphicFeatureDescriptor, PointsDataFeature, ColorFeature#, CmapFeature, ThicknessFeature
1111
from .selectors import LinearRegionSelector, LinearSelector
1212

1313

1414
class LineGraphic(Graphic, Interaction):
15-
feature_events = {"data", "colors", "cmap", "thickness", "present"}
15+
features = {"data", "colors"}#, "cmap", "thickness", "present"}
1616

1717
def __init__(
1818
self,
@@ -24,6 +24,7 @@ def __init__(
2424
cmap_values: np.ndarray | Iterable = None,
2525
z_position: float = None,
2626
collection_index: int = None,
27+
isolated_buffer: bool = True,
2728
*args,
2829
**kwargs,
2930
):
@@ -64,6 +65,7 @@ def __init__(
6465
Features
6566
--------
6667
68+
6769
**data**: :class:`.ImageDataFeature`
6870
Manages the line [x, y, z] positions data buffer, allows regular and fancy indexing.
6971
@@ -81,26 +83,24 @@ def __init__(
8183
8284
"""
8385

84-
self.data = PointsDataFeature(self, data, collection_index=collection_index)
86+
self._data = PointsDataFeature(data, isolated_buffer=isolated_buffer)
8587

8688
if cmap is not None:
87-
n_datapoints = self.data().shape[0]
89+
n_datapoints = self._data.value.shape[0]
8890

8991
colors = parse_cmap_values(
9092
n_colors=n_datapoints, cmap_name=cmap, cmap_values=cmap_values
9193
)
9294

93-
self.colors = ColorFeature(
94-
self,
95+
self._colors = ColorFeature(
9596
colors,
96-
n_colors=self.data().shape[0],
97+
n_colors=self._data.value.shape[0],
9798
alpha=alpha,
98-
collection_index=collection_index,
9999
)
100100

101-
self.cmap = CmapFeature(
102-
self, self.colors(), cmap_name=cmap, cmap_values=cmap_values
103-
)
101+
# self.cmap = CmapFeature(
102+
# self, self.colors(), cmap_name=cmap, cmap_values=cmap_values
103+
# )
104104

105105
super().__init__(*args, **kwargs)
106106

@@ -109,14 +109,12 @@ def __init__(
109109
else:
110110
material = pygfx.LineMaterial
111111

112-
self.thickness = ThicknessFeature(self, thickness)
112+
# self.thickness = ThicknessFeature(self, thickness)
113113

114114
world_object: pygfx.Line = pygfx.Line(
115115
# self.data.feature_data because data is a Buffer
116-
geometry=pygfx.Geometry(positions=self.data(), colors=self.colors()),
117-
material=material(
118-
thickness=self.thickness(), color_mode="vertex", pick_write=True
119-
),
116+
geometry=pygfx.Geometry(positions=self._data.buffer, colors=self._colors.buffer),
117+
material=material(thickness=thickness, color_mode="vertex"),
120118
)
121119

122120
self._set_world_object(world_object)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.