Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Polygon connection decorator
Polygon connection decorator [message #630181] Thu, 30 September 2010 22:25 Go to next message
Shenxue Zhou is currently offline Shenxue ZhouFriend
Messages: 60
Registered: July 2009
Member
I used the following code snippet in trying to create a solid (filled) polygon decorator for connections:

ConnectionDecorator cd = peCreateService.createConnectionDecorator(connection, false, 1.0, true);

Polygon polygon = Graphiti.getGaCreateService().createPolygon(cd, new int[] { -8, 4, 0, 0, -8, -4, -5, 0 });

polygon.setFilled(true);

However, the arrows created for the connections appear to be hollow. I also tried to add additional point to the point array so that the first point and last point are the same. That didn't seem to make a difference.

Am I doing something wrong? Or Graphiti doesn't support filled polygons as connection decorators?

Thanks!

Shenxue
Re: Polygon connection decorator [message #630241 is a reply to message #630181] Fri, 01 October 2010 09:29 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
This should work the way you try to do it. Probably there is no background
color set (or white is set)?

Michael

"Shenxue Zhou" <shenxue.zhou@oracle.com> wrote in message
news:i832k1$lfc$1@news.eclipse.org...
>I used the following code snippet in trying to create a solid (filled)
>polygon decorator for connections:
>
> ConnectionDecorator cd =
> peCreateService.createConnectionDecorator(connection, false, 1.0, true);
>
> Polygon polygon = Graphiti.getGaCreateService().createPolygon(cd, new
> int[] { -8, 4, 0, 0, -8, -4, -5, 0 });
>
> polygon.setFilled(true);
>
> However, the arrows created for the connections appear to be hollow. I
> also tried to add additional point to the point array so that the first
> point and last point are the same. That didn't seem to make a difference.
>
> Am I doing something wrong? Or Graphiti doesn't support filled polygons as
> connection decorators?
>
> Thanks!
>
> Shenxue
Re: Polygon connection decorator [message #630389 is a reply to message #630241] Fri, 01 October 2010 19:45 Go to previous messageGo to next message
Shenxue Zhou is currently offline Shenxue ZhouFriend
Messages: 60
Registered: July 2009
Member
Michael Wenz wrote on Fri, 01 October 2010 05:29
This should work the way you try to do it. Probably there is no background
color set (or white is set)?

Michael




I've tried to set the polygon's background color black (which matches my connection color) but the polygon decorator still appeared to be hollow.

Could this be a bug? Should I open a bugzilla bug?

Thanks!

Shenxue
Re: Polygon connection decorator [message #630811 is a reply to message #630389] Tue, 05 October 2010 06:51 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
It seems to be not in the framework. I took your coding and used it within
the tutorial for drawing the arrows of references. It works perfectly and
the arrow is filled. Here the method I changed in the class
TutorialAddEReferenceFeature:

private Polygon createArrow(GraphicsAlgorithmContainer gaContainer) {

Polygon polygon =
Graphiti.getGaCreateService().createPolygon(gaContainer, new int[] { -8, 4,
0, 0, -8, -4, -5, 0 });

polygon.setBackground(manageColor(IColorConstant.BLACK));

polygon.setFilled(true);


return polygon;

}

Michael

"Shenxue Zhou" <shenxue.zhou@oracle.com> wrote in message
news:i85dja$mct$1@news.eclipse.org...
> Michael Wenz wrote on Fri, 01 October 2010 05:29
>> This should work the way you try to do it. Probably there is no
>> background color set (or white is set)?
>>
>> Michael
>
>
> I've tried to set the polygon's background color black (which matches my
> connection color) but the polygon decorator still appeared to be hollow.
>
> Could this be a bug? Should I open a bugzilla bug?
>
> Thanks!
>
> Shenxue
Re: Polygon connection decorator [message #630931 is a reply to message #630811] Tue, 05 October 2010 15:34 Go to previous messageGo to next message
Shenxue Zhou is currently offline Shenxue ZhouFriend
Messages: 60
Registered: July 2009
Member
Michael,

I tried your code snippet and it worked. The only difference between my code and your code is I tried to use a style for polygon background. Here you directly set the background color on the polygon. Is it possible the style is not inherited down to connection decorators?

Thanks for your help!

Shenxue
Re: Polygon connection decorator [message #631178 is a reply to message #630931] Wed, 06 October 2010 13:28 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
The style needs to be set for the decorator as well. There is no automatic
propagation down the containment hierarchie.

Michael

"Shenxue Zhou" <shenxue.zhou@oracle.com> wrote in message
news:i8fgco$hmh$1@news.eclipse.org...
> Michael,
>
> I tried your code snippet and it worked. The only difference between my
> code and your code is I tried to use a style for polygon background. Here
> you directly set the background color on the polygon. Is it possible the
> style is not inherited down to connection decorators?
>
> Thanks for your help!
>
> Shenxue
Re: Polygon connection decorator [message #631230 is a reply to message #631178] Wed, 06 October 2010 16:00 Go to previous message
Shenxue Zhou is currently offline Shenxue ZhouFriend
Messages: 60
Registered: July 2009
Member
Michael Wenz wrote on Wed, 06 October 2010 07:28
The style needs to be set for the decorator as well. There is no automatic
propagation down the containment hierarchie.

Michael



I think I did set the style on the polygon decorator:

Polygon polygon = Graphiti.getGaCreateService().createPolygon(gaContainer, new int[] { -8, 4, 0, 0, -8, -4, -5, 0 });

polygon.setStyle(myStyle);

Here myStyle references a style with background color of black.

Shenxue
Previous Topic:Graphiti Release 0.7.0 is available for download
Next Topic:Non-Rounded Polyline connection
Goto Forum:
  


Current Time: Tue Apr 23 17:38:07 GMT 2024

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

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

Back to the top