dhale / jtk

The Mines Java Toolkit
http://inside.mines.edu/~dhale/jtk/
Apache License 2.0
83 stars 56 forks source link

Generic flippability in TiledViews? #21

Open ericaddison opened 8 years ago

ericaddison commented 8 years ago

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!

dhale commented 8 years ago

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.

ericaddison commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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

7-22-2016 12-27-32 pm