Polygon connection decorator [message #630181] |
Thu, 30 September 2010 22:25 |
Shenxue Zhou 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 |
Michael Wenz 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 #630811 is a reply to message #630389] |
Tue, 05 October 2010 06:51 |
Michael Wenz 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 #631230 is a reply to message #631178] |
Wed, 06 October 2010 16:00 |
Shenxue Zhou 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
|
|
|
Powered by
FUDForum. Page generated in 0.03392 seconds