Skip to main content


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 LiuYuchaoFriend
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: Fri Mar 29 06:51:02 GMT 2024

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

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

Back to the top