Custom Zooming [message #194510] |
Thu, 01 September 2005 21:46 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Andreas Holtz 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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 #514656 is a reply to message #194657] |
Tue, 16 February 2010 09:09 |
Ben Wecker 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 #514696 is a reply to message #514688] |
Tue, 16 February 2010 11:33 |
Vijay Raj 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
|
|
|
Powered by
FUDForum. Page generated in 0.04185 seconds