PRImA-Research-Lab / prima-page-viewer

Java based viewer for PAGE XML files (layout + text content). Also supports ALTO XML, FineReader XML, and HOCR.
Apache License 2.0
34 stars 9 forks source link

Show baselines #18

Open bertsky opened 3 years ago

bertsky commented 3 years ago

page-viewer-baselines

This is the bare minimum. You might want to add a new button to switch this on or off. Perhaps Aletheia already has an icon for that?

Also, I had to import org.primaresearch.dla.page.layout.physical.text.impl.TextLine, because there is no interface which gives get_Baseline().

bertsky commented 3 years ago

Fixes #17

bertsky commented 3 years ago

Note: 9cfcd81 fixes mouse scroll wheel behaviour. I never got ctrl+scroll zooming to work before (and was surprised to find an implementation). It seems that only the Canvas is in charge of events (not parent i.e. Shell). Also, when I did move the event receiver from parent to imageCanvas, I noticed that shift+scroll now did both horizontal and vertical scrolling, hence the extra checking. Plus MOD1 seems less reliable portable to me than CTRL|COMMAND.

I'll promptly rewrite (and rebase) that part of the PR if you find anything objectionable here.

bertsky commented 3 years ago

Strangely, if I export the app as runnable JAR, I get a different behaviour for mouse wheel scrolling than running directly from Eclipse!

When running from Eclipse, ctrl+scroll correctly zooms in or out, depending on the direction. But when running from the runnable JAR, MouseEvent e.count is always positive, so it always zooms in (regardless of direction). That's despite the fact that count's sign does yield the correct direction for horizontal or vertical scrolling. (And yes, I have configured the Project JRE in Eclipse's Run/debug settings, and the Build path > Libraries uses the same java-11-openjdk as my command line invocation.) :confused:

bertsky commented 3 years ago

Another strange thing is that in my newly built version, #15 re-appears. My understanding was that this was fixed by https://github.com/PRImA-Research-Lab/prima-page-viewer/commit/ad75ac2dc1b81701f529291bcebdd901d716a455 and https://github.com/PRImA-Research-Lab/prima-core-libs/commit/28db6c09bd7d50dcadebc31a1c67c7c047adf41b.

Since I have not changed the build settings, PrimaDla is included as a project, and I can see those commits are there.

So perhaps @chris1010010 you used some additional changes for the 1.4.06 binary release that you have not published yet?

bertsky commented 3 years ago

Plus the prebuilt version can deal with TIFF images, whereas the configured build cannot.

chris1010010 commented 3 years ago

I have merge in the baseline code

bertsky commented 3 years ago

I have merge in the baseline code

Splendid. So how about that part:

Note: 9cfcd81 fixes mouse scroll wheel behaviour. I never got ctrl+scroll zooming to work before (and was surprised to find an implementation). It seems that only the Canvas is in charge of events (not parent i.e. Shell). Also, when I did move the event receiver from parent to imageCanvas, I noticed that shift+scroll now did both horizontal and vertical scrolling, hence the extra checking. Plus MOD1 seems less ~reliable~ portable to me than CTRL|COMMAND.

bertsky commented 3 years ago

Plus the prebuilt version can deal with TIFF images, whereas the configured build cannot.

(happens for me e.g. for 16-bit TIFF or grayscale TIFF)

org.eclipse.swt.SWTException: Unsupported color depth

Do you import some additional library for your GH release builds?

chris1010010 commented 3 years ago

No, it's all the same SWT as far as I'm aware. Regarding the mouse scroll, I wanted to test in different OS

bertsky commented 3 years ago

No, it's all the same SWT as far as I'm aware.

I see. Then perhaps this is a change between OpenJDK 8 and 11? Or do you use a different JDK8 for your prebuilds?

Regarding the mouse scroll, I wanted to test in different OS

Understood. Did mouse wheel based horizontal/vertical scrolling and zooming work for you so far on any platform? (I've only ever tested Linux 64 bit with OpenJDK 8, and there neither horizontal scrolling nor zooming worked.)

But mind that extra trip of runnable JAR vs running in Eclipse...