Home » Eclipse Projects » GEF » Clipping problem
| |
Re: Clipping problem [message #202690 is a reply to message #202444] |
Fri, 11 November 2005 16:37 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
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 #202742 is a reply to message #202690] |
Fri, 11 November 2005 22:12 |
Felix L J Mayer Messages: 202 Registered: July 2009 |
Senior Member |
|
|
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 #202819 is a reply to message #202742] |
Sun, 13 November 2005 03:41 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
"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.
|
|
| |
Re: Clipping problem [message #202885 is a reply to message #202877] |
Mon, 14 November 2005 21: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 23:21 |
Felix L J Mayer Messages: 202 Registered: July 2009 |
Senior Member |
|
|
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] |
Wed, 16 November 2005 04:08 |
Felix L J Mayer Messages: 202 Registered: July 2009 |
Senior Member |
|
|
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 #203086 is a reply to message #202919] |
Thu, 17 November 2005 15:52 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
A layout will only happen if a revalidate() happened previously. Did you
make a change to the connection that you thought would trigger a
revalidate()? I'd have to see the code to help you more.
"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?
|
|
| |
Re: Clipping problem [message #203134 is a reply to message #203117] |
Thu, 17 November 2005 20:47 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:dligeb$i50$1@news.eclipse.org...
> As you can see in my post from 11/15/2005, I am now calling a
> Figure.revalidate() in my EditPart, and this solved my problem. There is
> just so much to learn about GEF...
I saw that. but why are you calling it manually? What is it you are doing
that requires the bounds to be recalculated, yet it isn't happening for
free? For example, setLineWidth should update the bounds.
setRoutingConstraint calls revalidate. adding or removing a child calls
revalidate too. It makes me think you might be doing something strange like
manipulating the PointList directly or something.
|
|
| |
Re: Clipping problem [message #204414 is a reply to message #203141] |
Fri, 02 December 2005 19:10 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
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: Fri Jan 24 04:52:36 GMT 2025
Powered by FUDForum. Page generated in 0.07315 seconds
|