7
7
8
8
from ..utils import parse_cmap_values
9
9
from ._base import Graphic , Interaction , PreviouslyModifiedData
10
- from ._features import PointsDataFeature , ColorFeature , CmapFeature , ThicknessFeature
10
+ from ._features import GraphicFeatureDescriptor , PointsDataFeature , ColorFeature # , CmapFeature, ThicknessFeature
11
11
from .selectors import LinearRegionSelector , LinearSelector
12
12
13
13
14
14
class LineGraphic (Graphic , Interaction ):
15
- feature_events = {"data" , "colors" , "cmap" , "thickness" , "present" }
15
+ features = {"data" , "colors" } # , "cmap", "thickness", "present"}
16
16
17
17
def __init__ (
18
18
self ,
@@ -24,6 +24,7 @@ def __init__(
24
24
cmap_values : np .ndarray | Iterable = None ,
25
25
z_position : float = None ,
26
26
collection_index : int = None ,
27
+ isolated_buffer : bool = True ,
27
28
* args ,
28
29
** kwargs ,
29
30
):
@@ -64,6 +65,7 @@ def __init__(
64
65
Features
65
66
--------
66
67
68
+
67
69
**data**: :class:`.ImageDataFeature`
68
70
Manages the line [x, y, z] positions data buffer, allows regular and fancy indexing.
69
71
@@ -81,26 +83,24 @@ def __init__(
81
83
82
84
"""
83
85
84
- self .data = PointsDataFeature (self , data , collection_index = collection_index )
86
+ self ._data = PointsDataFeature (data , isolated_buffer = isolated_buffer )
85
87
86
88
if cmap is not None :
87
- n_datapoints = self .data () .shape [0 ]
89
+ n_datapoints = self ._data . value .shape [0 ]
88
90
89
91
colors = parse_cmap_values (
90
92
n_colors = n_datapoints , cmap_name = cmap , cmap_values = cmap_values
91
93
)
92
94
93
- self .colors = ColorFeature (
94
- self ,
95
+ self ._colors = ColorFeature (
95
96
colors ,
96
- n_colors = self .data () .shape [0 ],
97
+ n_colors = self ._data . value .shape [0 ],
97
98
alpha = alpha ,
98
- collection_index = collection_index ,
99
99
)
100
100
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
+ # )
104
104
105
105
super ().__init__ (* args , ** kwargs )
106
106
@@ -109,14 +109,12 @@ def __init__(
109
109
else :
110
110
material = pygfx .LineMaterial
111
111
112
- self .thickness = ThicknessFeature (self , thickness )
112
+ # self.thickness = ThicknessFeature(self, thickness)
113
113
114
114
world_object : pygfx .Line = pygfx .Line (
115
115
# 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" ),
120
118
)
121
119
122
120
self ._set_world_object (world_object )
0 commit comments