Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Rotating a child figure according to its parent sides
Rotating a child figure according to its parent sides [message #173942] Sun, 24 February 2008 01:14 Go to next message
Eclipse UserFriend
Originally posted by: mehrdad.saadatmand.gmail.com

Hi,

I have a child figure with affixed parent side set to west. However, I'd
like to rotate the figure(it's a kind of arrow) if users try to add it to
the parent figure from other sides, like top, bottom or to the right side of
the parent figure. What can I do to provide this feature?

Is it possible as a solution to have four different figures (rotated ones)
for the child figure for each side and then when the figure is added check
which side it's added to, and then change the figure to the appropriate one
; if so how can I implement this?

Thanks,
Mehrdad Saadatmand
Re: Rotating a child figure according to its parent sides [message #174094 is a reply to message #173942] Mon, 25 February 2008 09:54 Go to previous message
Eclipse UserFriend
Originally posted by: ali.akar.geensys.com

hello,

I suggest you to use a Triangle, its easy to rotate it.

override the methide Triangle#primTranslate() in this methode u can call
another methode like setArrowOrientation() and the code on this
methode will look like :

private void setArrowOrientation() {

// call relocate to update the current side of parent
getBorderItemLocator().relocate(getFigure());

int newSide = getBorderItemLocator().getCurrentSideOfParent();

switch (newSide) {

case PositionConstants.NORTH:
fig.setOrientation(PositionConstants.VERTICAL);
fig.setDirection(PositionConstants.NORTH);
break;

case PositionConstants.SOUTH:
fig.setOrientation(PositionConstants.VERTICAL);
fig.setDirection(PositionConstants.SOUTH);
break;

case PositionConstants.EAST:
fig.setOrientation(PositionConstants.HORIZONTAL);
fig.setDirection(PositionConstants.EAST);
break;

default PositionConstants.WEST:
fig.setOrientation(PositionConstants.HORIZONTAL);
fig.setDirection(PositionConstants.WEST);
break;


regards,
Ali




Mehrdad Saadatmand a écrit :
> Hi,
>
> I have a child figure with affixed parent side set to west. However, I'd
> like to rotate the figure(it's a kind of arrow) if users try to add it to
> the parent figure from other sides, like top, bottom or to the right side of
> the parent figure. What can I do to provide this feature?
>
> Is it possible as a solution to have four different figures (rotated ones)
> for the child figure for each side and then when the figure is added check
> which side it's added to, and then change the figure to the appropriate one
> ; if so how can I implement this?
>
> Thanks,
> Mehrdad Saadatmand
>
>
>
Previous Topic:gmftools problem
Next Topic:How to set a fixed location of inner ports?
Goto Forum:
  


Current Time: Tue Apr 23 07:58:55 GMT 2024

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

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

Back to the top