Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Polyline Edit (How to edit a Polyline In GEF)
Polyline Edit [message #661511] Fri, 25 March 2011 02:11
LiuYuchao is currently offline LiuYuchao
Messages: 1
Registered: March 2011
Junior Member
hello
I have made a tool that draws a polyline. I have the points of the polyline in my model. What I want to do is to have a resize handle over each point.but i dont kown how to add the resize handles at each point in the polyline to simply move that point around - in any direction. I understood that I must develope something like PolylineResizableEditPolicy and return this policy in XYLayoutEditPolicy::createChildEditPolicy(EditPart child). My PolylineResizableEditPolicy has a method named
createSelectionHandles().
someone write the this codes :
protected List<ResizeHandle> createSelectionHandles() { 
List<ResizeHandle> list = new ArrayList<ResizeHandle>(); 
List<Point> points=((GraphicsPolyline)getHost().getModel()).getPointsList(); 
for(int i=0;i<points.size();i++) 
{ 
Figure moveHandleRef=new Figure(); 
moveHandleRef.setSize(7, 7); 
moveHandleRef.setLocation(new Point(points.get(i).x-2,points.get(i).y-2)); 
MoveHandleLocator mhl=new MoveHandleLocator(moveHandleRef); 
list.add(new ResizeHandle((GraphicalEditPart) getHost(),mhl,null)); 
} 
return list; 
}


and said overwrite getLocator() function can make it work.but I dont kown how to overwrite the function?
can someone help me ,and anyone konws other ways to make it work?
Previous Topic:TemplateTransferDragSourceListener.getTemplate() returns null
Next Topic:Multiple connection layers
Goto Forum:
  


Current Time: Tue Sep 23 12:33:14 GMT 2014

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

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