Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Custom Zooming
Custom Zooming [message #194510] Thu, 01 September 2005 21:46 Go to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Can someone please explain this to me. In the javadoc of
setZoomLevelContributions method in the ZoomManager class, it says

"Sets the list of zoom level contributions (as strings). If you contribute
something other than FIT_HEIGHT, FIT_WIDTH and FIT_ALL you must subclass
this class and override this method to implement your contributed zoom
function."

Does that mean I have to subclass ZoomManager? If so, how do I tell GEF
to use this new ZoomManager since the init of the
ScalableFreeformRootEditPart already calls a default one for you.

I am trying to set my own custom zooming so I need to ovverride the
zoomlevels.

Thank you,
Harsh
Re: Custom Zooming [message #194561 is a reply to message #194510] Fri, 02 September 2005 06:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mail4zlq.gmail.com

At first,yes!you must subclass ZoomManager.
To "tell GEF to use this new ZoomManager",you can subclass
"ScalableFreeformRootEditPart" and overwrite "getZoomManager".
and in your editor overwrite "configureGraphicalViewer" set the
rootEditPart use you customer RootEditPart ...

good luck!!!

Harsh Sabikhi 写道:
> Can someone please explain this to me. In the javadoc of
> setZoomLevelContributions method in the ZoomManager class, it says
> "Sets the list of zoom level contributions (as strings). If you
> contribute something other than FIT_HEIGHT, FIT_WIDTH and FIT_ALL you
> must subclass this class and override this method to implement your
> contributed zoom function."
>
> Does that mean I have to subclass ZoomManager? If so, how do I tell GEF
> to use this new ZoomManager since the init of the
> ScalableFreeformRootEditPart already calls a default one for you.
>
> I am trying to set my own custom zooming so I need to ovverride the
> zoomlevels.
>
> Thank you,
> Harsh
>
Re: Custom Zooming [message #194616 is a reply to message #194510] Fri, 02 September 2005 09:22 Go to previous messageGo to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Harsh Sabikhi schrieb am 01.09.2005 23:46:
> I am trying to set my own custom zooming so I need to ovverride the
> zoomlevels.

Do you want to define only own zoomlevels?
Like 20%, 50%, 66%, etc?
If yes, jsut create an array with your zoomlevels within configureGraphicalViewer() of your editorclass:

GraphicalViewer viewer = getGraphicalViewer();
ScalableRootEditPart rootEditPart = new ScalableRootEditPart();
viewer.setRootEditPart(rootEditPart);
ZoomManager manager = rootEditPart.getZoomManager();
double[] zoomLevels = new double[] { 0.05, 0.1, 0.25, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 };
manager.setZoomLevels(zoomLevels);
ArrayList zoomContributions = new ArrayList();
zoomContributions.add(ZoomManager.FIT_ALL);
zoomContributions.add(ZoomManager.FIT_HEIGHT);
zoomContributions.add(ZoomManager.FIT_WIDTH);
manager.setZoomLevelContributions(zoomContributions);

Andreas
Re: Custom Zooming [message #194631 is a reply to message #194616] Fri, 02 September 2005 13:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Thank you all for your feedback.

I am doing something pretty complicated. It's not as simply as zooming
in/out with different levels.

Basically, the user can select a range in the editor with the marquee tool
and decide to zoom in. What I have to implement is to show only these
edit parts and fit them in the visible window.

Harsh
Re: Custom Zooming [message #194641 is a reply to message #194631] Fri, 02 September 2005 17:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Partik/Randy,

Just wondering about the following function in ZoomManager

/**
* Currently does nothing.
* @param rect a rectangle
*/
public void zoomTo(Rectangle rect) { }

Are there any plans to implement this in a future release?

Thank you,
Harsh
Re: Custom Zooming [message #194657 is a reply to message #194631] Sat, 03 September 2005 09:00 Go to previous messageGo to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Harsh schrieb am 02.09.2005 15:28:
> Thank you all for your feedback.
>
> I am doing something pretty complicated. It's not as simply as zooming
> in/out with different levels.
>
> Basically, the user can select a range in the editor with the marquee
> tool and decide to zoom in. What I have to implement is to show only
> these edit parts and fit them in the visible window.

I solved a similary problem with a wrapper object.
Instead of using a concrete rootmodelelement I wrapped it.
The new element references the elements to show and the root model element.
The content of your graphicalviewer is the wrapper element.
The edipartfactory now reacts on the wrapper instead the rootModelElement.

for example:
yor model A with children B and C.
User selects C, so now the visible child of A is C.
The getModelChildren method of editPart_A (corresponding to the wrapper) must return the elements referenced in the wrapper. (in the example
it references C, in your case a list of the selected elements).

In your case it could be difficult to zoomout.
But perhaps this idea could help you. It works for me in cooperation with the outlineview.

Andreas
Re: Custom Zooming [message #514656 is a reply to message #194657] Tue, 16 February 2010 09:09 Go to previous messageGo to next message
Ben Wecker is currently offline Ben WeckerFriend
Messages: 4
Registered: February 2010
Junior Member
Quote:

At first,yes!you must subclass ZoomManager.
To "tell GEF to use this new ZoomManager",you can subclass
"ScalableFreeformRootEditPart" and overwrite "getZoomManager".



Just one comment on this. It does not really look like ZoomManager and ScalableFreeformRootEditPart are supposed to be subclassed. All the fields, e.g. zoomManager in ScalableFreeformRootEditPart are or zoom in ZoomManager are private. In order to properly extend these classes, those fields should be protected.
I want to override primSetZoom(), because I want a custom zoom behaviour. However this is the place, where "this.zoom = zoom" is set, what is necessary for most other methods to work in a correct way.

[Updated on: Tue, 16 February 2010 09:45]

Report message to a moderator

Re: Custom Zooming [message #514686 is a reply to message #514656] Tue, 16 February 2010 10:54 Go to previous messageGo to next message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
I think MarqueeSelect zoom has been implemented in GMF

REF:
http://www.eclipse.org/forums/index.php?t=msg&goto=51319 1&#msg_513191

org.eclipse.gmf.runtime.diagram.ui.internal.tools.ZoomTool
is the implementation you are looking for..right??


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Re: Custom Zooming [message #514688 is a reply to message #514686] Tue, 16 February 2010 11:04 Go to previous messageGo to next message
Ben Wecker is currently offline Ben WeckerFriend
Messages: 4
Registered: February 2010
Junior Member
Thanks, I do not want to have marquee selection zoom. To make my issue more comprehensive: in my view I display an image, which I have in several zoom levels. So, when the zoom is executed, I want to load the image in another zoom level. I would do this by calling a method in primSetZoom(). However, I want to use all the other functionality that is already implemented in ZoomManager. As a workaround, I copied most methods from ZooManager, and introduce my own fields "zoom" and "listeners". I definetely do not want to use GMF.
Re: Custom Zooming [message #514696 is a reply to message #514688] Tue, 16 February 2010 11:33 Go to previous message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
I think ZoomInAction and ZoomOutAction does that only!!



---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Previous Topic:GEF incubator proposal discussion
Next Topic:Change Zomm ComboBox width in my GEF editor
Goto Forum:
  


Current Time: Fri Apr 26 23:12:52 GMT 2024

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

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

Back to the top