Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » FigureCanvas and scrolling problems
FigureCanvas and scrolling problems [message #149948] Mon, 06 September 2004 16:13 Go to next message
Skhiri Sabri is currently offline Skhiri SabriFriend
Messages: 23
Registered: July 2009
Junior Member
Hi evrybody,

I have a problem when I scroll my FigureCanvas. Before I worked with a
Canvas and a Composite ScrollPane that doesn't look as Native interface.
Then I switched with a FigureCanvas, but now when I scroll my
FigureCanvas, the figures placed by a ConnectionLocator at the end of my
PolylineConnections disappear. But they disappear only when I touch the
scrollbar and if I return the scrollbar in its initial position (on top),
the figures placed in the head of the PolylineConnection appear correctly.

When I scroll the FiguraCanvas, the Anchors and all others figures seems
placed as they should, while the figures placed in the head of the
Polylines not. I think that my problem may coming from the
ConnectionLocator because it is the only object involved in the
calculation of the position of these figures.

The declaration of the FigureCanvas :

system =
new LightweightSystem(principalCanvas);
principalCanvas = new FigureCanvas(parent,system);
principalCanvas.setScrollBarVisibility(FigureCanvas.AUTOMATI C);
principalCanvas.getViewport().setContents(figure);


I add my figures in the head of the PolylineConnection as following:

GlyphCircle circle = new GlyphCircle(
((Circle) head.getShape()).getRadius(), 10, 10,
image,
node, label);
circle.setOpaque(head.getOpacity());
circle.setAlignment(head.getAlignmentTxt());
ConnectionLocator relationshipLocator = new VBMConnectionLocator(
connection, align);
connection.add(circle, relationshipLocator);


Can anyone help me ?


Thanks.


Sabri.
Re: FigureCanvas and scrolling problems [message #149989 is a reply to message #149948] Tue, 07 September 2004 14:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Probably the problem is in using relative coordinates. Perhaps problems
with the anchor or decoration locators? Post that code or look at out
implkementations for clues.

"Skhiri Gabouje Sabri" <sskhirid@ulb.ac.be> wrote in message
news:chi2bj$ppo$1@eclipse.org...
> Hi evrybody,
>
> I have a problem when I scroll my FigureCanvas. Before I worked with a
> Canvas and a Composite ScrollPane that doesn't look as Native interface.
> Then I switched with a FigureCanvas, but now when I scroll my
> FigureCanvas, the figures placed by a ConnectionLocator at the end of my
> PolylineConnections disappear. But they disappear only when I touch the
> scrollbar and if I return the scrollbar in its initial position (on top),
> the figures placed in the head of the PolylineConnection appear correctly.
>
> When I scroll the FiguraCanvas, the Anchors and all others figures seems
> placed as they should, while the figures placed in the head of the
> Polylines not. I think that my problem may coming from the
> ConnectionLocator because it is the only object involved in the
> calculation of the position of these figures.
>
> The declaration of the FigureCanvas :
>
> system =
> new LightweightSystem(principalCanvas);
> principalCanvas = new FigureCanvas(parent,system);
> principalCanvas.setScrollBarVisibility(FigureCanvas.AUTOMATI C);
> principalCanvas.getViewport().setContents(figure);
>
>
> I add my figures in the head of the PolylineConnection as following:
>
> GlyphCircle circle = new GlyphCircle(
> ((Circle) head.getShape()).getRadius(), 10, 10,
> image,
> node, label);
> circle.setOpaque(head.getOpacity());
> circle.setAlignment(head.getAlignmentTxt());
> ConnectionLocator relationshipLocator = new VBMConnectionLocator(
> connection, align);
> connection.add(circle, relationshipLocator);
>
>
> Can anyone help me ?
>
>
> Thanks.
>
>
> Sabri.
>
Re: FigureCanvas and scrolling problems [message #150322 is a reply to message #149989] Thu, 09 September 2004 14:45 Go to previous messageGo to next message
Skhiri Sabri is currently offline Skhiri SabriFriend
Messages: 23
Registered: July 2009
Junior Member
Thanks Randy, the problem coming from the figure attached to the Line.
Actually, this figure paint itself but according to the point returned by
the locator (in ABSOLUTE coordinate). So now, I translate to relative the
point returned by the locator.

Thanks !

Sabri.

Randy Hudson wrote:

> Probably the problem is in using relative coordinates. Perhaps problems
> with the anchor or decoration locators? Post that code or look at out
> implkementations for clues.

> "Skhiri Gabouje Sabri" <sskhirid@ulb.ac.be> wrote in message
> news:chi2bj$ppo$1@eclipse.org...
> > Hi evrybody,
> >
> > I have a problem when I scroll my FigureCanvas. Before I worked with a
> > Canvas and a Composite ScrollPane that doesn't look as Native interface.
> > Then I switched with a FigureCanvas, but now when I scroll my
> > FigureCanvas, the figures placed by a ConnectionLocator at the end of my
> > PolylineConnections disappear. But they disappear only when I touch the
> > scrollbar and if I return the scrollbar in its initial position (on top),
> > the figures placed in the head of the PolylineConnection appear correctly.
> >
> > When I scroll the FiguraCanvas, the Anchors and all others figures seems
> > placed as they should, while the figures placed in the head of the
> > Polylines not. I think that my problem may coming from the
> > ConnectionLocator because it is the only object involved in the
> > calculation of the position of these figures.
> >
> > The declaration of the FigureCanvas :
> >
> > system =
> > new LightweightSystem(principalCanvas);
> > principalCanvas = new FigureCanvas(parent,system);
> > principalCanvas.setScrollBarVisibility(FigureCanvas.AUTOMATI C);
> > principalCanvas.getViewport().setContents(figure);
> >
> >
> > I add my figures in the head of the PolylineConnection as following:
> >
> > GlyphCircle circle = new GlyphCircle(
> > ((Circle) head.getShape()).getRadius(), 10, 10,
> > image,
> > node, label);
> > circle.setOpaque(head.getOpacity());
> > circle.setAlignment(head.getAlignmentTxt());
> > ConnectionLocator relationshipLocator = new VBMConnectionLocator(
> > connection, align);
> > connection.add(circle, relationshipLocator);
> >
> >
> > Can anyone help me ?
> >
> >
> > Thanks.
> >
> >
> > Sabri.
> >
Re: FigureCanvas and scrolling problems [message #150345 is a reply to message #149989] Thu, 09 September 2004 16:53 Go to previous message
Eclipse UserFriend
Originally posted by: travkin.gmx.de

Hello,

I think I have a problem with absolute and relative coordinates, too.

I have implemented some classes that inherit from ChopboxAnchor. One of
them returns a point on the border of a rhomb (for a rhomb figure) in
the method getLocation(...), but SOMETIMES a parent figure translates
the coordinates such that they do not fit anymore or - and that is even
worse - one side of a connection is moved to a point very far away from
the original one and the canvas is growing infinitely. What do I do
wrong? Here is the code:

public Point getLocation (Point reference)
{
Point center = this.getBox().getCenter();
this.getOwner().translateToAbsolute (center);

Rectangle r = this.getBox();
Point north = new Point (r.x + r.width / 2, r.y);
Point south = new Point (r.x + r.width / 2, r.y + r.height);
Point west = new Point (r.x, r.y + r.height / 2);
Point east = new Point (r.x + r.width, r.y + r.height / 2);

Point intersection = null;

if (reference.x <= north.x)
{ // left side

if (reference.y <= west.y)
{ // upper left side

// intersection with left upper line /
intersection = GeometricHelper.intersectionPointOfLines
(north, west, center, reference);
}
else
{ // lower left side

// intersection with left lower line \
intersection = GeometricHelper.intersectionPointOfLines
(west, south, center, reference);
}
}
else
{ // right side

if (reference.y <= west.y)
{ // upper right side

// intersection with right upper line \
intersection = GeometricHelper.intersectionPointOfLines
(north, east, center, reference);
}
else
{ // lower right side

// intersection with right lower line /
intersection = GeometricHelper.intersectionPointOfLines
(east, south, center, reference);
}
}

if (intersection != null)
{
//if (Math.abs(intersection.x) > 1000 ||
Math.abs(intersection.y) > 1000)
System.out.println("BOX: "+this.getBox());

System.out.println("POINT:"+this.getOwner().getClass().getName()+ " ->
"+intersection);
return intersection;
}
else
{
return super.getLocation (reference);
}
}


Could somebody please tell me, if I have to use relative or absolute
coordinates for the center point and if I have to translate the
intersection point?

Bye
Dietrich Travkin

Randy Hudson wrote:
> Probably the problem is in using relative coordinates. Perhaps problems
> with the anchor or decoration locators? Post that code or look at out
> implkementations for clues.
>
> "Skhiri Gabouje Sabri" <sskhirid@ulb.ac.be> wrote in message
> news:chi2bj$ppo$1@eclipse.org...
>
>>Hi evrybody,
>>
>>I have a problem when I scroll my FigureCanvas. Before I worked with a
>>Canvas and a Composite ScrollPane that doesn't look as Native interface.
>>Then I switched with a FigureCanvas, but now when I scroll my
>>FigureCanvas, the figures placed by a ConnectionLocator at the end of my
>>PolylineConnections disappear. But they disappear only when I touch the
>>scrollbar and if I return the scrollbar in its initial position (on top),
>>the figures placed in the head of the PolylineConnection appear correctly.
>>
>>When I scroll the FiguraCanvas, the Anchors and all others figures seems
>>placed as they should, while the figures placed in the head of the
>>Polylines not. I think that my problem may coming from the
>>ConnectionLocator because it is the only object involved in the
>>calculation of the position of these figures.
>>
>>The declaration of the FigureCanvas :
>>
>>system =
>> new LightweightSystem(principalCanvas);
>>principalCanvas = new FigureCanvas(parent,system);
>> principalCanvas.setScrollBarVisibility(FigureCanvas.AUTOMATI C);
>>principalCanvas.getViewport().setContents(figure);
>>
>>
>>I add my figures in the head of the PolylineConnection as following:
>>
>> GlyphCircle circle = new GlyphCircle(
>> ((Circle) head.getShape()).getRadius(), 10, 10,
>>image,
>> node, label);
>> circle.setOpaque(head.getOpacity());
>> circle.setAlignment(head.getAlignmentTxt());
>> ConnectionLocator relationshipLocator = new VBMConnectionLocator(
>> connection, align);
>> connection.add(circle, relationshipLocator);
>>
>>
>>Can anyone help me ?
>>
>>
>>Thanks.
>>
>>
>>Sabri.
>>
>
>
>
Previous Topic:Shape
Next Topic:Grid Origin Question
Goto Forum:
  


Current Time: Fri Apr 26 16:34:06 GMT 2024

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

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

Back to the top