[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] setroutingconstraint curve problem

Hi everyone,

I have a connector extends PolylineConnection rather than PolylineConnectionEx.
For all my other connectors, that extend PolylineConnectionEx, they curve smoothly after I call:


///////////////////////////////////////////
RoutingStyle style = (RoutingStyle) view.getStyle(NotationPackage.eINSTANCE.getRoutingStyle());
style.setSmoothness(org.eclipse.gmf.runtime.notation.Smoothness.NORMAL_LITERAL);
///////////////////////////////////////////


in

their respective view factories, but for the one connector that extends PolylineConnection, it doesn't curve at all.

Now, I read that there still might be a way to curve it using routing constraints (setroutingconstraint)?
I can't seem to get the code right, and it's just not working properly. Can someone post an example of how it's done?


This is what I have so far:

///////////////////////////////////////////
public class DependencyLineConnection extends PolylineConnection {
........

protected void outlineShape(Graphics g) {
	.......

	ConnectionRouter connectionRouter = this.getConnectionRouter();
	ArrayList<AbsoluteBendpoint> list = new ArrayList<AbsoluteBendpoint>();
		
	list.add(new AbsoluteBendpoint(midPoint));
	this.setRoutingConstraint(list);
///////////////////////////////////////////

This doesn't work, and the line disappears. Any tips?
Thanks in advance.

~Kelvin Ng