Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphics refactor, again #88

Merged
merged 1 commit into from Dec 25, 2022
Merged

graphics refactor, again #88

merged 1 commit into from Dec 25, 2022

Conversation

kushalkolar
Copy link
Member

@kushalkolar kushalkolar commented Dec 25, 2022

some ideas from #85 and more

Added:

  • added CmapFeature which basically wraps ColorFeature and just provides a __setitem__ that parses a user provided str cmap to a [n_points, rgba] array using n_colors based on the slice
  • added ImageCmapFeature
  • ImageDataFeature which handles ImageGraphic data as as pygfx.Texture
  • PointsDataFeature which handles data for LineGraphic and ScatterGraphic
  • BaseGraphic which just parses the class name in __init_subclass__ and adds a string type class attribute which is used by Subplot to add the various add_<graphic_name> methods.
  • Graphic has a position property which is basically just world_object.position

Modified:

  • Graphic doesn't instantiate any of the graphic features now, it just handles name and a few other thing and some methods. The individual graphics now handle their features like data, colors, cmap, etc.
  • ImageGraphic uses vmin, vmax now instead of clim, update ImageWidget accordingly.
  • ImageGraphic uses TextureView to set geometry.grid instead of Texture, this allows setting the filter argument to Texture.get_view(filter=...), default is "nearest"
  • ImageGraphic cmap setting is now functional, it uses a ImageCmapFeature instance to manage it.
  • Subplot.add_graphic sets the z_position based on the number of Graphics in the subplot
  • removed utils.fix_data and utils.to_float32, these are now in the data features classes or module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant