Polyline Edit [message #661511] |
Thu, 24 March 2011 22:11 |
Eclipse User |
|
|
|
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?
|
|
|
Powered by
FUDForum. Page generated in 0.03285 seconds