Hello Liang Guo

> I am now developing an image comparison project,
> viewing two images side by side. I can ZoomIn/Out and
> Pan either one of images independently. But what I
> want to do next is to link these two images, once you
> ZoomIn/Out or Pan one of the images, the other one is
> also automatically performed, so you can compare
> multi-temporal images in a same location with time
> difference.


Maybe you can get some idea from the following class on SourceForge:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/seagis/experimental/net/seas/awt/ZoomPane.java?rev=1.11&content-type=text/vnd.viewcvs-markup


This is the ZoomPane class in the "seagis" project. Basically, you can
register a ZoomListener. ZoomPane listen for the following events:

* Zoom, rotation and translation using the keyboard.
* Zoom, rotation and translation using a contextual menu.
* Zoom by selecting an area with the mouse.
* Zoom using the mouse wheel.
* Translating using the usual scrollbars.

All zoom events, no matter how it have been performed, fire a ZoomEvent
with an AffineTransform containing the zoom change. You can listen for
ZoomEvent from one ZoomPane and apply the zoom change (using
AffineTransform.concatenate(AffineTransform)) on any other ZoomPane. I
use that to do exactly what you want: compage a set of multi-temporal
images in a same location with time difference.

If you don't want the whole ZoomPane class but just want to look at the
code, you may look more specifically at the following method:

private void transform(final int operation, final double amount, final
Point2D center)


        Regards,

                        Martin Desruisseaux

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to