Package research

Source Code of research.PolyLineLocator

/*
* @(#)PolyLineLocator.java
*
* Project:    JHotdraw - a GUI framework for technical drawings
*        http://www.jhotdraw.org
*        http://jhotdraw.sourceforge.net
* Copyright:  ? by the original author(s) and all contributors
* License:    Lesser GNU Public License (LGPL)
*        http://www.opensource.org/licenses/lgpl-license.html
*/

package research;

import research.figure.PolyLineFigure;

import java.awt.*;


/**
* A poly line figure consists of a list of points.
* It has an optional line decoration at the start and end.
*
* @see LineDecoration
*
* @version <$CURRENT_VERSION$>
*/
public class PolyLineLocator extends AbstractLocator {
  int fIndex;

  public PolyLineLocator(int index) {
    fIndex = index;
  }

  public Point locate(Figure owner) {
    PolyLineFigure plf = (PolyLineFigure)owner;
    // guard against changing PolyLineFigures -> temporary hack
    if (fIndex < plf.pointCount()) {
      return ((PolyLineFigure)owner).pointAt(fIndex);
    }
    return new Point(0, 0);
  }
}
TOP

Related Classes of research.PolyLineLocator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.