Back to index

moin  1.9.0~rc2
PolygonHandle.java
Go to the documentation of this file.
00001 /*
00002  * Fri Feb 28 07:47:13 1997  Doug Lea  (dl at gee)
00003  * Based on PolyLineHandle
00004  */
00005 
00006 package CH.ifa.draw.contrib;
00007 
00008 import java.awt.*;
00009 import java.util.*;
00010 import java.io.IOException;
00011 import CH.ifa.draw.framework.*;
00012 import CH.ifa.draw.util.*;
00013 import CH.ifa.draw.standard.*;
00014 
00015 
00019 public class PolygonHandle extends AbstractHandle {
00020 
00021   private int fIndex;
00022   private Locator fLocator;
00023 
00030   public PolygonHandle(PolygonFigure owner, Locator l, int index) {
00031     super(owner);
00032     fLocator = l;
00033     fIndex = index;
00034   }
00035 
00036   public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) {
00037     myOwner().setPointAt(new Point(x, y), fIndex);
00038   }
00039 
00040   public void invokeEnd  (int x, int y, int anchorX, int anchorY, DrawingView view) {
00041     myOwner().smoothPoints();
00042   }
00043 
00044   public Point locate() {
00045     return fLocator.locate(owner());
00046   }
00047 
00048   private PolygonFigure myOwner() {
00049     return (PolygonFigure)owner();
00050   }
00051 }
00052 
00053