PolygonFigure [message #150863] |
Tue, 14 September 2004 22:05 |
Eclipse User |
|
|
|
Originally posted by: seasnake.gmx.li
I'm using a Polygon to draw a rhombus but i get a strange behavior:
When the rightmost vertex and the bottom vertex of rhombus match the bound
of the constrain used to place the Figure in editor then moving the edit
part with mouse lets the selection handles stay where the edit part was
and the Figure itself is moved. I can interrupt moving the Figure around
and start again, but this has no effect on selection handles.
Drawing a rhombus smaller or greater than the constrain provides the
desired behavior.
Is there a solution to avoid this problem?
Best regards
Ilja
|
|
|
|
Re: PolygonFigure [message #151101 is a reply to message #150863] |
Wed, 15 September 2004 16:41 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
There is a Figure class called Polygon. It is not designed to be dragged or
placed by its bounds. Have you created your own class called
PolygonFigure??
"Ilja" <seasnake@gmx.li> wrote in message news:ci7pus$6to$1@eclipse.org...
> I'm using a Polygon to draw a rhombus but i get a strange behavior:
>
> When the rightmost vertex and the bottom vertex of rhombus match the bound
> of the constrain used to place the Figure in editor then moving the edit
> part with mouse lets the selection handles stay where the edit part was
> and the Figure itself is moved. I can interrupt moving the Figure around
> and start again, but this has no effect on selection handles.
>
> Drawing a rhombus smaller or greater than the constrain provides the
> desired behavior.
>
> Is there a solution to avoid this problem?
>
> Best regards
> Ilja
>
|
|
|
Re: PolygonFigure [message #151133 is a reply to message #151101] |
Wed, 15 September 2004 19:39 |
Eclipse User |
|
|
|
Originally posted by: seasnake.gmx.li
I didn't create a PolygonFigure. Here the refreshVisuals code:
protected void refreshVisuals() {
Association assoc = (Association) getModel();
Polygon outline = (Polygon) getFigure();
Point leftTopCornerLoc = assoc.getLocation();
Dimension size = assoc.getSizes();
PointList vertices = new PointList(4);
Point rhombusVertex = new Point();
// vertex in the top middle of the rect
rhombusVertex.x = leftTopCornerLoc.x + size.width / 2;
rhombusVertex.y = leftTopCornerLoc.y;
vertices.addPoint(rhombusVertex);
rhombusVertex = new Point();
// vertex in the right middle of the rect
rhombusVertex.x = leftTopCornerLoc.x + size.width;
rhombusVertex.y = leftTopCornerLoc.y + size.height / 2;
vertices.addPoint(rhombusVertex);
rhombusVertex = new Point();
// vertex in the bottom middle of the rect
rhombusVertex.x = leftTopCornerLoc.x + size.width / 2;
rhombusVertex.y = leftTopCornerLoc.y + size.height;
vertices.addPoint(rhombusVertex);
rhombusVertex = new Point();
// vertex in the left middle of the rect
rhombusVertex.x = leftTopCornerLoc.x;
rhombusVertex.y = leftTopCornerLoc.y + size.height / 2;
vertices.addPoint(rhombusVertex);
outline.setPoints(vertices);
Rectangle r = new Rectangle(leftTopCornerLoc, size);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, outline,
r);
}
Randy Hudson wrote:
> There is a Figure class called Polygon. It is not designed to be dragged or
> placed by its bounds. Have you created your own class called
> PolygonFigure??
> "Ilja" <seasnake@gmx.li> wrote in message news:ci7pus$6to$1@eclipse.org...
> > I'm using a Polygon to draw a rhombus but i get a strange behavior:
> >
> > When the rightmost vertex and the bottom vertex of rhombus match the bound
> > of the constrain used to place the Figure in editor then moving the edit
> > part with mouse lets the selection handles stay where the edit part was
> > and the Figure itself is moved. I can interrupt moving the Figure around
> > and start again, but this has no effect on selection handles.
> >
> > Drawing a rhombus smaller or greater than the constrain provides the
> > desired behavior.
> >
> > Is there a solution to avoid this problem?
> >
> > Best regards
> > Ilja
> >
|
|
|
Re: PolygonFigure [message #151141 is a reply to message #150877] |
Wed, 15 September 2004 19:40 |
Eclipse User |
|
|
|
Originally posted by: seasnake.gmx.li
here is my code:
protected void refreshVisuals() {
Association assoc = (Association) getModel();
Polygon outline = (Polygon) getFigure();
Point leftTopCornerLoc = assoc.getLocation();
Dimension size = assoc.getSizes();
PointList vertices = new PointList(4);
Point rhombusVertex = new Point();
// vertex in the top middle of the rect
rhombusVertex.x = leftTopCornerLoc.x + size.width / 2;
rhombusVertex.y = leftTopCornerLoc.y;
vertices.addPoint(rhombusVertex);
rhombusVertex = new Point();
// vertex in the right middle of the rect
rhombusVertex.x = leftTopCornerLoc.x + size.width;
rhombusVertex.y = leftTopCornerLoc.y + size.height / 2;
vertices.addPoint(rhombusVertex);
rhombusVertex = new Point();
// vertex in the bottom middle of the rect
rhombusVertex.x = leftTopCornerLoc.x + size.width / 2;
rhombusVertex.y = leftTopCornerLoc.y + size.height;
vertices.addPoint(rhombusVertex);
rhombusVertex = new Point();
// vertex in the left middle of the rect
rhombusVertex.x = leftTopCornerLoc.x;
rhombusVertex.y = leftTopCornerLoc.y + size.height / 2;
vertices.addPoint(rhombusVertex);
outline.setPoints(vertices);
Rectangle r = new Rectangle(leftTopCornerLoc, size);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, outline,
r);
}
Pratik Shah wrote:
> I don't understand what you're saying. Are you saying that you're
> experiencing this problem in the case where the rhombus is a square? Please
> clarify what the problem is.
> "Ilja" <seasnake@gmx.li> wrote in message news:ci7pus$6to$1@eclipse.org...
> > I'm using a Polygon to draw a rhombus but i get a strange behavior:
> >
> > When the rightmost vertex and the bottom vertex of rhombus match the bound
> > of the constrain used to place the Figure in editor then moving the edit
> > part with mouse lets the selection handles stay where the edit part was
> > and the Figure itself is moved. I can interrupt moving the Figure around
> > and start again, but this has no effect on selection handles.
> >
> > Drawing a rhombus smaller or greater than the constrain provides the
> > desired behavior.
> >
> > Is there a solution to avoid this problem?
> >
> > Best regards
> > Ilja
> >
|
|
|
Re: PolygonFigure [message #151149 is a reply to message #151133] |
Wed, 15 September 2004 21:34 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
XYLayout will be calling setBounds() which is not supported by Polygon.
But, besides that, there is a bug in your code. You cannot paint on the
right and bottom sides of the bounding box, so you should either make the
box bigger, or bring in the points by 1 pixel.
"Ilja" <seasnake@gmx.li> wrote in message news:cia5pv$2ng$1@eclipse.org...
> I didn't create a PolygonFigure. Here the refreshVisuals code:
>
> protected void refreshVisuals() {
> Association assoc = (Association) getModel();
> Polygon outline = (Polygon) getFigure();
> Point leftTopCornerLoc = assoc.getLocation();
> Dimension size = assoc.getSizes();
>
> PointList vertices = new PointList(4);
>
> Point rhombusVertex = new Point();
> // vertex in the top middle of the rect
> rhombusVertex.x = leftTopCornerLoc.x + size.width / 2;
> rhombusVertex.y = leftTopCornerLoc.y;
> vertices.addPoint(rhombusVertex);
>
> rhombusVertex = new Point();
> // vertex in the right middle of the rect
> rhombusVertex.x = leftTopCornerLoc.x + size.width;
> rhombusVertex.y = leftTopCornerLoc.y + size.height / 2;
> vertices.addPoint(rhombusVertex);
>
> rhombusVertex = new Point();
> // vertex in the bottom middle of the rect
> rhombusVertex.x = leftTopCornerLoc.x + size.width / 2;
> rhombusVertex.y = leftTopCornerLoc.y + size.height;
> vertices.addPoint(rhombusVertex);
>
> rhombusVertex = new Point();
> // vertex in the left middle of the rect
> rhombusVertex.x = leftTopCornerLoc.x;
> rhombusVertex.y = leftTopCornerLoc.y + size.height / 2;
> vertices.addPoint(rhombusVertex);
>
> outline.setPoints(vertices);
>
>
> Rectangle r = new Rectangle(leftTopCornerLoc, size);
> ((GraphicalEditPart) getParent()).setLayoutConstraint(this, outline,
> r);
> }
>
> Randy Hudson wrote:
>
> > There is a Figure class called Polygon. It is not designed to be
dragged or
> > placed by its bounds. Have you created your own class called
> > PolygonFigure??
> > "Ilja" <seasnake@gmx.li> wrote in message
news:ci7pus$6to$1@eclipse.org...
> > > I'm using a Polygon to draw a rhombus but i get a strange behavior:
> > >
> > > When the rightmost vertex and the bottom vertex of rhombus match the
bound
> > > of the constrain used to place the Figure in editor then moving the
edit
> > > part with mouse lets the selection handles stay where the edit part
was
> > > and the Figure itself is moved. I can interrupt moving the Figure
around
> > > and start again, but this has no effect on selection handles.
> > >
> > > Drawing a rhombus smaller or greater than the constrain provides the
> > > desired behavior.
> > >
> > > Is there a solution to avoid this problem?
> > >
> > > Best regards
> > > Ilja
> > >
>
>
|
|
|
Re: PolygonFigure [message #151156 is a reply to message #151149] |
Wed, 15 September 2004 21:59 |
Eclipse User |
|
|
|
Originally posted by: seasnake.gmx.li
Hi Randy, thank you. Well there is no bug the "bug" will occur when I
whould subtract 1 from the width and the height. And this lead to behavior
described below.
I will follow your advise and just make my rhombus 1 pixel smaller than my
bounding rect.
Thank you for your help
Best regards
Ilja
|
|
|
Powered by
FUDForum. Page generated in 0.04007 seconds