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

move class-specific draw methods out of View3d and into Vxyz and Pxyz #154

Conversation

bbean23
Copy link
Collaborator

@bbean23 bbean23 commented Aug 10, 2024

  • move View3d.draw_Vxyz() to Vxyz.draw_list()
  • move View3d.draw_single_Pxyz() to Pxyz.draw_points()

@bbean23 bbean23 added the enhancement New feature or request label Aug 10, 2024
@bbean23 bbean23 self-assigned this Aug 10, 2024
braden6521
braden6521 previously approved these changes Aug 21, 2024
Copy link
Collaborator

@braden6521 braden6521 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbean23, thanks for the changes. I have approved, but I have a few questions. I'll leave it up to you if you want to change anything after this. I would be happy to review again if needed.

view.draw_single_Pxyz(origin)
Pxyz(origin).draw_point(view)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is Pxyz(...) necessary here? It looks like origin is already type Pxyz. There are also several other cases of this I've seen but not pointed out each one.
If origin is in facet already a Pxyz, this is not necessarily wrong, just redundant and possibly confusing. You're call.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was because origin was a Vyxz and needed to be a Pxyz and I wanted to draw it with the draw_point() method. Now that the method is in Vyxz class I don't need this conversion anymore.

Comment on lines 501 to 519
def draw_list(
self,
figure: rcfr.RenderControlFigureRecord | v3d.View3d,
close: bool = None,
style: rcps.RenderControlPointSeq = None,
label: str = None,
) -> None:
"""Calls figure.draw_xyz_list(self.data.T) with the default arguments in place for any None's."""
kwargs = dict()
for key, val in [('close', close), ('style', style), ('label', label)]:
if val is not None:
kwargs[key] = val

view = figure if isinstance(figure, v3d.View3d) else figure.view
view.draw_xyz_list(self.data.T, **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this called "draw_list" when there are no lists involved?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm basing it off of the method draw_xyz_list() in View3d.py. But you're right. I changed the name for this class (but not in View3d).

Comment on lines 27 to 41
def draw_point(
self,
figure: rcfr.RenderControlFigureRecord | v3d.View3d,
style: rcps.RenderControlPointSeq = None,
labels: list[str] = None,
):
"""Calls figure.draw_xyz(p) for all points in this instance, and with
the default arguments in place for any None's."""
if style is None:
style = rcps.default(markersize=2)
if labels is None:
labels = [None] * len(self)
view = figure if isinstance(figure, v3d.View3d) else figure.view
for x, y, z, label in zip(self.x, self.y, self.z, labels):
view.draw_xyz((x, y, z), style, label)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this make sense to add to Vxyz instead since Pxyz inherits Vxyz?
Furthermore, what is the difference between draw_point and draw_list? Could they be combined into one function altogether?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is that draw_points draws each point individually, vs draw_list which draws all points together as a single series. Updated the documentation to match and moved the method into Vxyz.

@bbean23 bbean23 force-pushed the 153-move-drawing-options-out-of-view3d-and-into-vxyz-and-pxzy-classes branch from 345bc3e to 0a45ef0 Compare September 6, 2024 16:52
@bbean23
Copy link
Collaborator Author

bbean23 commented Sep 6, 2024

@braden6521 I think I addressed all your comments. Please re-approve so that I can merge.

@bbean23 bbean23 requested a review from braden6521 October 21, 2024 16:43
e10harvey
e10harvey previously approved these changes Oct 31, 2024
Copy link
Collaborator

@e10harvey e10harvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbean23: Thank you for these changes. Please add documentation for parameters where noted. I'll work on getting these included in the sphinx docs after this is merged. If you still cannot merge after making the changes I requested, please let me know.

opencsp/common/lib/geometry/Vxyz.py Outdated Show resolved Hide resolved
opencsp/common/lib/geometry/Vxyz.py Show resolved Hide resolved
@e10harvey e10harvey merged commit 0a7e5ba into sandialabs:develop Nov 11, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants