Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Zoom and Thumbnail
Zoom and Thumbnail [message #175395] Mon, 04 April 2005 16:41 Go to next message
Skhiri Sabri is currently offline Skhiri SabriFriend
Messages: 23
Registered: July 2009
Junior Member
Hi,

I have a problem concerning zoom and thumbnail view. I'am in this
situation:
My principal draw2D view: LwSystem->FigureCanvas-> my figure (Simple
Figure)
The thumbnail of my figure : LwSystem2-> ScrollableThumbnail-> my figure
(as content of the ScrollableThumbnail, and the viewPort of the Figure
Canvas is passed to the its constructor)

Where ("->" means "contents").

First, It works nice, I don't have any problem.
But I have added some zoom functionalities, I have followed the
ZoomContainer example and I have introduced the these methods directly in
"my figure".
Then if I use the code below in the paintClientArea(gracphics) of my
figure, the thumbnail doesn't works !
(http://cs-devel.ulb.ac.be/tmp/vbm.png)
paintClientArea(Graphics gracphics) {
if (getChildren().isEmpty())
return;
boolean optimizeClip = getBorder() == null ||
getBorder().isOpaque();
graphics.pushState();
ScaledGraphics g = new ScaledGraphics(graphics);
if (!optimizeClip)
g.clipRect(getBounds().getCropped(getInsets()));

g.translate(getBounds().x + getInsets().left, getBounds().y
+ getInsets().top);
g.scale(zoomFactor);
g.pushState();
paintChildren(g);
g.popState();
g.dispose();
graphics.popState();
graphics.restoreState();
}

But if remove the code and if I replace it by this:

paintClientArea(Graphics gracphics) {
super.paintClientArea(graphics);
}

the thumbnail works well!! But, of course, the zoom doens't works.

Some can say me:
1. if I have done something wrong ?
2. What is the link between paintClientArea() of my figure and the
thumbnail ? Why is it so sensible to this method ?


Thanks !
Re: Zoom and Thumbnail [message #175489 is a reply to message #175395] Mon, 04 April 2005 23:45 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
It should work. This is, in essence, the same setup as the logic example,
where the editor's contents are being shown in an overview in the outline
page. The ZoomExample you mention also has some commented code. Uncomment
it to see the thumbnail. You can use a FigureCanvas for the original LWS
and change the code to be a ScrollableThumbnail, and that should work too.

You can compare your setup to that one. You'll just have to debug to find
out what's going wrong.

BTW, take the methods from ScalableLayerPane instead of ZoomContainer.
They're more correct. I don't think that's the problem here, though.

"Skhiri Sabri" <sskhirid@ulb.ac.be> wrote in message
news:2ae7888ae6451299f93014d565f66a46$1@www.eclipse.org...
> Hi,
>
> I have a problem concerning zoom and thumbnail view. I'am in this
> situation:
> My principal draw2D view: LwSystem->FigureCanvas-> my figure (Simple
> Figure)
> The thumbnail of my figure : LwSystem2-> ScrollableThumbnail-> my figure
> (as content of the ScrollableThumbnail, and the viewPort of the Figure
> Canvas is passed to the its constructor)
>
> Where ("->" means "contents").
>
> First, It works nice, I don't have any problem.
> But I have added some zoom functionalities, I have followed the
> ZoomContainer example and I have introduced the these methods directly in
> "my figure".
> Then if I use the code below in the paintClientArea(gracphics) of my
> figure, the thumbnail doesn't works !
> (http://cs-devel.ulb.ac.be/tmp/vbm.png)
> paintClientArea(Graphics gracphics) {
> if (getChildren().isEmpty())
> return;
> boolean optimizeClip = getBorder() == null ||
> getBorder().isOpaque();
> graphics.pushState();
> ScaledGraphics g = new ScaledGraphics(graphics);
> if (!optimizeClip)
> g.clipRect(getBounds().getCropped(getInsets()));
>
> g.translate(getBounds().x + getInsets().left, getBounds().y
> + getInsets().top);
> g.scale(zoomFactor);
> g.pushState();
> paintChildren(g);
> g.popState();
> g.dispose();
> graphics.popState();
> graphics.restoreState();
> }
>
> But if remove the code and if I replace it by this:
>
> paintClientArea(Graphics gracphics) {
> super.paintClientArea(graphics);
> }
>
> the thumbnail works well!! But, of course, the zoom doens't works.
>
> Some can say me:
> 1. if I have done something wrong ?
> 2. What is the link between paintClientArea() of my figure and the
> thumbnail ? Why is it so sensible to this method ?
>
>
> Thanks !
>
Re: Zoom and Thumbnail [message #175537 is a reply to message #175489] Tue, 05 April 2005 08:05 Go to previous message
Skhiri Sabri is currently offline Skhiri SabriFriend
Messages: 23
Registered: July 2009
Junior Member
Thanks Patrik,

Good advice concerning the ScalableLayerPane, I have replaced methods of
ZoomContainer by those of ScalableLayerPane, and now the thumbnail view
works but only if I don't apply a zoom.
Figure @ normal size: http://cs-devel.ulb.ac.be/tmp/scale1.png
Figure @ zooming size: http://cs-devel.ulb.ac.be/tmp/scale2.png

The problem must come from one those methods, I will founded it out !

Thanks for your help.

Sabri.
Previous Topic:GEF TreeViewer
Next Topic:Export graphic to a file
Goto Forum:
  


Current Time: Tue Apr 23 12:24:18 GMT 2024

Powered by FUDForum. Page generated in 0.03667 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top