Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsRotating a child figure according to its parent sides
https://www.eclipse.org/forums/index.php/mv/msg/54664/173942/#msg_173942
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]]>2008-02-24T01:14:33-00:00Re: Rotating a child figure according to its parent sides
https://www.eclipse.org/forums/index.php/mv/msg/54664/174094/#msg_174094
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;
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
>
>
>]]>2008-02-25T09:54:05-00:00