Home » Eclipse Projects » GEF » Clipping problem
Clipping problem [message #202444] |
Wed, 09 November 2005 14:09  |
Eclipse User |
|
|
|
I have a strange problem when moving label children of a connection:
When to connection has just 2 labels, everything works fine, i.e. I can move
around the labels where I want. But when the connection has 4 labels and I
move one of them, it does not get redrawn at the target location. I debugged
my code and everything looks fine, but in Figure.paintChildren() the label
child does not intersect Graphics.getClip() and therefore is not painted.
The clipping region is much smaller when there are 4 children than when
there are 2. What can I do about this?
|
|
| | |
Re: Clipping problem [message #202742 is a reply to message #202690] |
Fri, 11 November 2005 17:12   |
Eclipse User |
|
|
|
Thanks, that enabled me to find the problem. The basic issue is the clipping
in Figure.paintChildren() in conjunction with the bounds of a
PolylineConnection, which seems to be determined by its points. For a
PolylineConnection whose child figures are anywhere on the diagram, the
chances are good that their bounds don't intersect with the
PolylineConnection one's, and then they don't get drawn.
I was able to get the behavior I want by creating my own ConnectionLayer
which removes all clipping from paintChildren(). I also tried to overwrite
PolylineConnection.getBounds() to union all the children in the bounds, but
that didn't produce the desired effect.
"Randy Hudson" <none@us.ibm.com> wrote in message
news:dl2hcv$29n$1@news.eclipse.org...
> The clip region should be exactly the bounds of hte figure being painted.
> The parent sets it.
>
> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
> news:dkthhh$7ir$1@news.eclipse.org...
>>I have a strange problem when moving label children of a connection:
>> When to connection has just 2 labels, everything works fine, i.e. I can
>> move around the labels where I want. But when the connection has 4 labels
>> and I move one of them, it does not get redrawn at the target location. I
>> debugged my code and everything looks fine, but in Figure.paintChildren()
>> the label child does not intersect Graphics.getClip() and therefore is
>> not painted. The clipping region is much smaller when there are 4
>> children than when there are 2. What can I do about this?
>>
>
>
|
|
| | |
Re: Clipping problem [message #202885 is a reply to message #202877] |
Mon, 14 November 2005 16:56   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
They are not movable per se but in some cases their bounds are entirely
outside the bounds of the connection. So if the connection's bounds were not
larger they would be clipped.
Is your diagram using freeform everywhere?
If you are hacking the clipping when you paint, then at some point you will
experience painting bugs. When your figure erases itself, it only damages
the area it used to occupy. If you were painting outside of that area, that
painting will linger until something else causes it to be repainted.
"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:dlafem$ph0$1@news.eclipse.org...
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:dl6clf$jp5$1@news.eclipse.org...
>>
>> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
>> news:dl350b$ti$1@news.eclipse.org...
>>> Thanks, that enabled me to find the problem. The basic issue is the
>>> clipping in Figure.paintChildren() in conjunction with the bounds of a
>>> PolylineConnection, which seems to be determined by its points. For a
>>> PolylineConnection whose child figures are anywhere on the diagram, the
>>> chances are good that their bounds don't intersect with the
>>> PolylineConnection one's, and then they don't get drawn.
>>
>> Which is why we go any fix the bounds in the specialized implementation
>> of layout() in PolylineConnection. Please see the EDiagram example for
>> labeled connections.
>>
>
> Have you made those labels moveable to anywhere in the diagram?
>
> That's when I started running into problems. When I just used a
> ConnectionEndPointLocator, there was always some overlap between the
> PolylineConnection's bounds and the labels, so they did get drawn. The
> reason I mention this is that I see now that my 3.1.1 version of
> PolylineConnection has layout() and getBounds() in place, but that didn't
> help me.
>
> Then I overrode paintChildren() in my subclass of PolylineConnection and
> the label was drawn correctly after I moved it, but when it got deselected
> it disappeared again.
>
> Only my patch to the ConnectionLayer resolved the issue.
>
|
|
|
Re: Clipping problem [message #202919 is a reply to message #202885] |
Mon, 14 November 2005 18:21   |
Eclipse User |
|
|
|
Actually I think my problem is that Figure.bounds is not set to null because
PolylineConnection.layout() is not called by
DeferredUpdateManager.fireValidating().
What could be the cause of this?
"Randy Hudson" <none@us.ibm.com> wrote in message
news:dlb15m$je8$1@news.eclipse.org...
> They are not movable per se but in some cases their bounds are entirely
> outside the bounds of the connection. So if the connection's bounds were
> not larger they would be clipped.
>
> Is your diagram using freeform everywhere?
>
> If you are hacking the clipping when you paint, then at some point you
> will experience painting bugs. When your figure erases itself, it only
> damages the area it used to occupy. If you were painting outside of that
> area, that painting will linger until something else causes it to be
> repainted.
>
> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
> news:dlafem$ph0$1@news.eclipse.org...
>>
>> "Randy Hudson" <none@us.ibm.com> wrote in message
>> news:dl6clf$jp5$1@news.eclipse.org...
>>>
>>> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
>>> news:dl350b$ti$1@news.eclipse.org...
>>>> Thanks, that enabled me to find the problem. The basic issue is the
>>>> clipping in Figure.paintChildren() in conjunction with the bounds of a
>>>> PolylineConnection, which seems to be determined by its points. For a
>>>> PolylineConnection whose child figures are anywhere on the diagram, the
>>>> chances are good that their bounds don't intersect with the
>>>> PolylineConnection one's, and then they don't get drawn.
>>>
>>> Which is why we go any fix the bounds in the specialized implementation
>>> of layout() in PolylineConnection. Please see the EDiagram example for
>>> labeled connections.
>>>
>>
>> Have you made those labels moveable to anywhere in the diagram?
>>
>> That's when I started running into problems. When I just used a
>> ConnectionEndPointLocator, there was always some overlap between the
>> PolylineConnection's bounds and the labels, so they did get drawn. The
>> reason I mention this is that I see now that my 3.1.1 version of
>> PolylineConnection has layout() and getBounds() in place, but that didn't
>> help me.
>>
>> Then I overrode paintChildren() in my subclass of PolylineConnection and
>> the label was drawn correctly after I moved it, but when it got
>> deselected it disappeared again.
>>
>> Only my patch to the ConnectionLayer resolved the issue.
>>
>
>
|
|
|
Re: Clipping problem [message #203008 is a reply to message #202919] |
Tue, 15 November 2005 23:08   |
Eclipse User |
|
|
|
A call to Figure.revalidate() in refreshVisuals() of the ConnectionEditPart
solved the problem without any hack in the clipping.
"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:dlb65m$qb6$1@news.eclipse.org...
> Actually I think my problem is that Figure.bounds is not set to null
> because PolylineConnection.layout() is not called by
> DeferredUpdateManager.fireValidating().
> What could be the cause of this?
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:dlb15m$je8$1@news.eclipse.org...
>> They are not movable per se but in some cases their bounds are entirely
>> outside the bounds of the connection. So if the connection's bounds were
>> not larger they would be clipped.
>>
>> Is your diagram using freeform everywhere?
>>
>> If you are hacking the clipping when you paint, then at some point you
>> will experience painting bugs. When your figure erases itself, it only
>> damages the area it used to occupy. If you were painting outside of that
>> area, that painting will linger until something else causes it to be
>> repainted.
>>
>> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
>> news:dlafem$ph0$1@news.eclipse.org...
>>>
>>> "Randy Hudson" <none@us.ibm.com> wrote in message
>>> news:dl6clf$jp5$1@news.eclipse.org...
>>>>
>>>> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
>>>> news:dl350b$ti$1@news.eclipse.org...
>>>>> Thanks, that enabled me to find the problem. The basic issue is the
>>>>> clipping in Figure.paintChildren() in conjunction with the bounds of a
>>>>> PolylineConnection, which seems to be determined by its points. For a
>>>>> PolylineConnection whose child figures are anywhere on the diagram,
>>>>> the chances are good that their bounds don't intersect with the
>>>>> PolylineConnection one's, and then they don't get drawn.
>>>>
>>>> Which is why we go any fix the bounds in the specialized implementation
>>>> of layout() in PolylineConnection. Please see the EDiagram example for
>>>> labeled connections.
>>>>
>>>
>>> Have you made those labels moveable to anywhere in the diagram?
>>>
>>> That's when I started running into problems. When I just used a
>>> ConnectionEndPointLocator, there was always some overlap between the
>>> PolylineConnection's bounds and the labels, so they did get drawn. The
>>> reason I mention this is that I see now that my 3.1.1 version of
>>> PolylineConnection has layout() and getBounds() in place, but that
>>> didn't help me.
>>>
>>> Then I overrode paintChildren() in my subclass of PolylineConnection and
>>> the label was drawn correctly after I moved it, but when it got
>>> deselected it disappeared again.
>>>
>>> Only my patch to the ConnectionLayer resolved the issue.
>>>
>>
>>
>
>
|
|
| | | | | |
Re: Clipping problem [message #206065 is a reply to message #204414] |
Fri, 23 December 2005 18:12  |
Eclipse User |
|
|
|
Saw your reply only just now. What do you mean by the validation mechanism?
"Randy Hudson" <none@us.ibm.com> wrote in message
news:dmq670$ckq$1@news.eclipse.org...
> So you would see the exact same problem with plain old figures. If you
> moved a child, the parent would not automatically expand to encompass the
> child. This is why the validation mechanism is the preferred way for
> position anything.
>
>> I am moving a child label of the connection. This does not trigger a
>> revalidate() of the connection, so the its bounds are not recalculated
>> and the label gets clipped. I don't see this problem with 2 labels,
>> because then I have a decoration at one end. The decoration is always
>> reset in refreshVisuals(), which does cause a revalidate().
>>
>
>
|
|
|
Goto Forum:
Current Time: Sun Apr 20 07:17:25 EDT 2025
Powered by FUDForum. Page generated in 0.04860 seconds
|