Back to index

moin  1.9.0~rc2
PolyLineLocator.java
Go to the documentation of this file.
00001 /*
00002  * @(#)PolyLineLocator.java 5.1
00003  *
00004  */
00005 
00006 package CH.ifa.draw.figures;
00007 
00008 import java.awt.*;
00009 import java.io.IOException;
00010 import CH.ifa.draw.framework.*;
00011 import CH.ifa.draw.standard.*;
00012 import CH.ifa.draw.util.*;
00013 
00020 class PolyLineLocator extends AbstractLocator {
00021     int fIndex;
00022 
00023     public PolyLineLocator(int index) {
00024         fIndex = index;
00025     }
00026 
00027     public Point locate(Figure owner) {
00028         PolyLineFigure plf = (PolyLineFigure)owner;
00029         // guard against changing PolyLineFigures -> temporary hack
00030         if (fIndex < plf.pointCount())
00031             return ((PolyLineFigure)owner).pointAt(fIndex);
00032         return new Point(0, 0);
00033     }
00034 }