BendPointConnectionRouter [message #232239] |
Mon, 26 March 2007 22:23 |
Eclipse User |
|
|
|
Originally posted by: kathir.atc.tcs.com
Hi ,
I am using the BendPointConnectionRouter to connect to two EditPart
Figures. The following is the code snippet
connection.setEndpoints(start, end);
BendpointConnectionRouter connectionRouter = new
BendpointConnectionRouter();
List<Bendpoint> list = new ArrayList<Bendpoint>();
list.add(new AbsoluteBendpoint(start.x, end.y));
connectionRouter.setConstraint(connection, list);
connection.setConnectionRouter(connectionRouter);
connection.setRoutingConstraint(list);
connectionRouter.route(connection);
But this doesnt work for me. I just get a straight line between the two
figures. Am i doing the right thing here !
Thanks in advance,
Kathir.
|
|
|
Re: BendPointConnectionRouter [message #232283 is a reply to message #232239] |
Tue, 27 March 2007 17:03 |
Anthony Hunter Messages: 446 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0029_01C77070.5803F190
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Kathir
Where are you putting this code snippet? I assume you are putting this =
code in createFigure() in your ConnectionEditPart?
Try:
protected IFigure createFigure() {
PolylineConnection connection =3D new PolylineConnection();
BendpointConnectionRouter connectionRouter =3D new =
BendpointConnectionRouter();
connection.setConnectionRouter(connectionRouter);
return connection;
}
protected void refreshVisuals() {
super.refreshVisuals();
PolylineConnection connection =3D (PolylineConnection) =
getFigure();
ConnectionRouter connectionRouter =3D =
connection.getConnectionRouter();
List list =3D new ArrayList();
list.add(new AbsoluteBendpoint(connection.getSourceAnchor()
.getReferencePoint().x, connection.getTargetAnchor()
.getReferencePoint().y));
connectionRouter.setConstraint(connection, list);
connection.setRoutingConstraint(list);
}
Cheers...
Anthony
"kathir" <kathir@atc.tcs.com> wrote in message =
news:eu9h4n$eg9$1@utils.eclipse.org...
>=20
> Hi ,
> I am using the BendPointConnectionRouter to connect to two EditPart=20
> Figures. The following is the code snippet
>=20
> connection.setEndpoints(start, end);
>=20
> BendpointConnectionRouter connectionRouter =3D new=20
> BendpointConnectionRouter();
>=20
> List<Bendpoint> list =3D new ArrayList<Bendpoint>();
> list.add(new AbsoluteBendpoint(start.x, end.y));
> connectionRouter.setConstraint(connection, list);
>=20
> connection.setConnectionRouter(connectionRouter);
> connection.setRoutingConstraint(list);
> connectionRouter.route(connection);
>=20
> But this doesnt work for me. I just get a straight line between the =
two=20
> figures. Am i doing the right thing here !
>=20
> Thanks in advance,
> Kathir.
------=_NextPart_000_0029_01C77070.5803F190
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3059" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi Kathir</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Where are you putting this code=20
snippet? I</FONT><FONT face=3DArial size=3D2> assume you are =
putting this code=20
in createFigure() in your ConnectionEditPart?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Try:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2> protected =
IFigure=20
createFigure() {<BR> =20
PolylineConnection connection =3D new=20
PolylineConnection();<BR> =20
BendpointConnectionRouter connectionRouter =3D new=20
BendpointConnectionRouter();<BR>  =
;=20
connection.setConnectionRouter(connectionRouter);<BR> &n=
bsp; =20
return connection;<BR> }</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2> protected =
void=20
refreshVisuals() {<BR> =20
super.refreshVisuals();<BR> =20
PolylineConnection connection =3D (PolylineConnection)=20
getFigure();<BR> =
ConnectionRouter=20
connectionRouter =3D=20
connection.getConnectionRouter();<BR> =
=20
List list =3D new =
ArrayList();<BR> =20
list.add(new=20
AbsoluteBendpoint(connection.getSourceAnchor()<BR>  =
;   ; =20
..getReferencePoint().x,=20
connection.getTargetAnchor()<BR>  =
; =20
..getReferencePoint().y));<BR> =20
connectionRouter.setConstraint(connection,=20
list);<BR> =20
connection.setRoutingConstraint(list);<BR> =
}<BR></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Cheers...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Anthony</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>"kathir" <</FONT><A=20
href=3D"mailto:kathir@atc.tcs.com"><FONT face=3DArial=20
size=3D2>kathir@atc.tcs.com</FONT></A><FONT face=3DArial size=3D2>> =
wrote in=20
message </FONT><A href=3D"news:eu9h4n$eg9$1@utils.eclipse.org"><FONT =
face=3DArial=20
size=3D2>news:eu9h4n$eg9$1@utils.eclipse.org</FONT></A><FONT =
face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>> <BR>> Hi =
,<BR>> I=20
am using the BendPointConnectionRouter to connect to two EditPart =
<BR>>=20
Figures. The following is the code snippet<BR>>=20
<BR> > &a mp;nbsp;  =
;=20
connection.setEndpoints(start, end);<BR>>=20
<BR> > &a mp;nbsp;  =
;=20
BendpointConnectionRouter connectionRouter =3D new <BR>>=20
BendpointConnectionRouter();<BR>>=20
<BR> > &a mp;nbsp;  =
;=20
List<Bendpoint> list =3D new=20
ArrayList<Bendpoint>();<BR> > &a mp;nbsp;=
=20
list.add(new AbsoluteBendpoint(start.x,=20
end.y));<BR> > &a mp;nbsp; &nb=
sp; =20
connectionRouter.setConstraint(connection, list);<BR>>=20
<BR> > &a mp;nbsp;  =
;=20
connection.setConnectionRouter(connectionRouter);<BR>> &nbs=
p; &nbs p; =20
connection.setRoutingConstraint(list);<BR>> &nb=
sp; &nb sp;=20
connectionRouter.route(connection);<BR>> <BR>> But this doesnt =
work for=20
me. I just get a straight line between the two <BR>> figures. Am i =
doing the=20
right thing here !<BR>> <BR>> Thanks in advance,<BR>> =
Kathir.</FONT>=20
</BODY></HTML>
------=_NextPart_000_0029_01C77070.5803F190--
|
|
|
Re: BendPointConnectionRouter [message #232297 is a reply to message #232283] |
Tue, 27 March 2007 18:08 |
Eclipse User |
|
|
|
Originally posted by: kathir.atc.tcs.com
Hi Anthony !
Thanks !
No luck on the bendpoint connection !
Actually i do all steps you mentioned inside my refreshVisuals(). I
create the connection inside my editpart.
I set the end points of the connection inside the refresh visuals every
time. and based on the endpoints my bendpoints will change.
I dont use ConnectionAnchor. Is this a must for a PolylineConnection?
I am not sure what is going wrong !
BR,
Kathir.
Anthony Hunter wrote:
> Hi Kathir
>
> Where are you putting this code snippet? I assume you are putting this
> code in createFigure() in your ConnectionEditPart?
>
> Try:
>
> protected IFigure createFigure() {
> PolylineConnection connection = new PolylineConnection();
> BendpointConnectionRouter connectionRouter = new
> BendpointConnectionRouter();
> connection.setConnectionRouter(connectionRouter);
> return connection;
> }
>
> protected void refreshVisuals() {
> super.refreshVisuals();
> PolylineConnection connection = (PolylineConnection) getFigure();
> ConnectionRouter connectionRouter =
> connection.getConnectionRouter();
> List list = new ArrayList();
> list.add(new AbsoluteBendpoint(connection.getSourceAnchor()
> .getReferencePoint().x, connection.getTargetAnchor()
> .getReferencePoint().y));
> connectionRouter.setConstraint(connection, list);
> connection.setRoutingConstraint(list);
> }
>
> Cheers...
> Anthony
>
> "kathir" <kathir@atc.tcs.com <mailto:kathir@atc.tcs.com>> wrote in
> message news:eu9h4n$eg9$1@utils.eclipse.org...
> >
> > Hi ,
> > I am using the BendPointConnectionRouter to connect to two EditPart
> > Figures. The following is the code snippet
> >
> > connection.setEndpoints(start, end);
> >
> > BendpointConnectionRouter connectionRouter = new
> > BendpointConnectionRouter();
> >
> > List<Bendpoint> list = new ArrayList<Bendpoint>();
> > list.add(new AbsoluteBendpoint(start.x, end.y));
> > connectionRouter.setConstraint(connection, list);
> >
> > connection.setConnectionRouter(connectionRouter);
> > connection.setRoutingConstraint(list);
> > connectionRouter.route(connection);
> >
> > But this doesnt work for me. I just get a straight line between the two
> > figures. Am i doing the right thing here !
> >
> > Thanks in advance,
> > Kathir.
|
|
|
Re: BendPointConnectionRouter [message #232303 is a reply to message #232297] |
Tue, 27 March 2007 20:20 |
Eclipse User |
|
|
|
Originally posted by: kathir.atc.tcs.com
ok, now it works.
I created the connection using the XYAnchor instead of using the
setEndPoints() method.
BR,
Kathir.
kathir wrote:
> Hi Anthony !
> Thanks !
>
> No luck on the bendpoint connection !
>
> Actually i do all steps you mentioned inside my refreshVisuals(). I
> create the connection inside my editpart.
> I set the end points of the connection inside the refresh visuals
> every time. and based on the endpoints my bendpoints will change.
>
> I dont use ConnectionAnchor. Is this a must for a PolylineConnection?
>
> I am not sure what is going wrong !
>
> BR,
> Kathir.
>
>
>
> Anthony Hunter wrote:
>> Hi Kathir
>>
>> Where are you putting this code snippet? I assume you are putting
>> this code in createFigure() in your ConnectionEditPart?
>>
>> Try:
>>
>> protected IFigure createFigure() {
>> PolylineConnection connection = new PolylineConnection();
>> BendpointConnectionRouter connectionRouter = new
>> BendpointConnectionRouter();
>> connection.setConnectionRouter(connectionRouter);
>> return connection;
>> }
>>
>> protected void refreshVisuals() {
>> super.refreshVisuals();
>> PolylineConnection connection = (PolylineConnection)
>> getFigure();
>> ConnectionRouter connectionRouter =
>> connection.getConnectionRouter();
>> List list = new ArrayList();
>> list.add(new AbsoluteBendpoint(connection.getSourceAnchor()
>> .getReferencePoint().x, connection.getTargetAnchor()
>> .getReferencePoint().y));
>> connectionRouter.setConstraint(connection, list);
>> connection.setRoutingConstraint(list);
>> }
>>
>> Cheers...
>> Anthony
>>
>> "kathir" <kathir@atc.tcs.com <mailto:kathir@atc.tcs.com>> wrote in
>> message news:eu9h4n$eg9$1@utils.eclipse.org...
>> >
>> > Hi ,
>> > I am using the BendPointConnectionRouter to connect to two EditPart
>> > Figures. The following is the code snippet
>> >
>> > connection.setEndpoints(start, end);
>> >
>> > BendpointConnectionRouter connectionRouter = new
>> > BendpointConnectionRouter();
>> >
>> > List<Bendpoint> list = new ArrayList<Bendpoint>();
>> > list.add(new AbsoluteBendpoint(start.x, end.y));
>> > connectionRouter.setConstraint(connection, list);
>> >
>> > connection.setConnectionRouter(connectionRouter);
>> > connection.setRoutingConstraint(list);
>> > connectionRouter.route(connection);
>> >
>> > But this doesnt work for me. I just get a straight line between the
>> two
>> > figures. Am i doing the right thing here !
>> >
>> > Thanks in advance,
>> > Kathir.
|
|
|
Powered by
FUDForum. Page generated in 0.03641 seconds