jtk icon indicating copy to clipboard operation
jtk copied to clipboard

Generic flippability in TiledViews?

Open ericaddison opened this issue 9 years ago • 5 comments

Hello there,

Would you entertain the idea of allowing public setters for the _xflipped and _yflipped booleans in PixelsView? (Or any TiledViews that support orientation?) Either that or add a couple of Orientation entries?

I am using PixelsView to make an F-K plot, which I would like to have with the non-existent orientation X1UP_X2RIGHT.

I would be willing to put this feature in if you agree to it.

Thanks!

ericaddison avatar Jul 05 '16 21:07 ericaddison

My mind is too engaged elsewhere to think carefully about this.

Shall we propose a fork with other (more?) committers?

Less ambitious would be someone else simply handling this issue.

dhale avatar Jul 06 '16 01:07 dhale

This can be a very simple tweak, so I imagine you could safely delegate responsibility for it...

The simplest and minimal impact change that would allow full customization, I think, would be to add protected accessor methods (for X and Y) protected boolean getXFlipped() and protected void setXFlipped() into PixelsView. These fields also exist in ContoursView, so it might make sense to do the same there. This change would allow subclasses of these views to do whatever they want in terms of plot orientation.

A different approach might be to implement the missing Orientations into any TiledView that supports Orientation, which would add BarsView, PointsView, and TensorsView to the list.

ericaddison avatar Jul 06 '16 13:07 ericaddison

Here is a new version with an additional Orientation value of X1UP_X2RIGHT. Very simple addition, and no change to any piece of the API: 14ca8d9. Below are images of switching between X1DOWN_X2RIGHT and X1UP_X2RIGHT.

fk1 fk2

ericaddison avatar Jul 11 '16 18:07 ericaddison

Here is a more complete version, with all 8 possible orientations. Also caught a mistake in updateBestProjectors() which was never used with your current Orientation options. most recent commit: 801c246

ericaddison avatar Jul 22 '16 17:07 ericaddison

Here are the four orientations with x1 on the horizontal axis. The other 4 look similar.

7-22-2016 12-27-32 pm

ericaddison avatar Jul 22 '16 17:07 ericaddison