| Line | Hits | Source |
|---|---|---|
| 1 | /* | |
| 2 | * Created on Oct 19, 2004 | |
| 3 | * | |
| 4 | * Copyright (c) 2004, the JUNG Project and the Regents of the University | |
| 5 | * of California | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * This software is open-source under the BSD license; see either | |
| 9 | * "license.txt" or | |
| 10 | * http://jung.sourceforge.net/license.txt for a description. | |
| 11 | */ | |
| 12 | package edu.uci.ics.jung.visualization; | |
| 13 | ||
| 14 | import java.awt.geom.GeneralPath; | |
| 15 | ||
| 16 | /** | |
| 17 | * A utility class for creating arrowhead shapes. | |
| 18 | * | |
| 19 | * @author Joshua O'Madadhain | |
| 20 | */ | |
| 21 | 0 | public class ArrowFactory |
| 22 | { | |
| 23 | /** | |
| 24 | * Returns an arrowhead in the shape of a simple isosceles triangle | |
| 25 | * with the specified base and height measurements. It is placed | |
| 26 | * with the vertical axis along the negative x-axis, with its base | |
| 27 | * centered on (0,0). | |
| 28 | */ | |
| 29 | public static GeneralPath getWedgeArrow(float base, float height) | |
| 30 | { | |
| 31 | 0 | GeneralPath arrow = new GeneralPath(); |
| 32 | 0 | arrow.moveTo(0,0); |
| 33 | 0 | arrow.lineTo( - height, base/2.0f); |
| 34 | 0 | arrow.lineTo( - height, -base/2.0f); |
| 35 | 0 | arrow.lineTo( 0, 0 ); |
| 36 | 0 | return arrow; |
| 37 | } | |
| 38 | ||
| 39 | /** | |
| 40 | * Returns an arrowhead in the shape of an isosceles triangle | |
| 41 | * with an isoceles-triangle notch taken out of the base, | |
| 42 | * with the specified base and height measurements. It is placed | |
| 43 | * with the vertical axis along the negative x-axis, with its base | |
| 44 | * centered on (0,0). | |
| 45 | */ | |
| 46 | public static GeneralPath getNotchedArrow(float base, float height, float notch_height) | |
| 47 | { | |
| 48 | 0 | GeneralPath arrow = new GeneralPath(); |
| 49 | 0 | arrow.moveTo(0,0); |
| 50 | 0 | arrow.lineTo(-height, base/2.0f); |
| 51 | 0 | arrow.lineTo(-(height - notch_height), 0); |
| 52 | 0 | arrow.lineTo(-height, -base/2.0f); |
| 53 | 0 | arrow.lineTo(0,0); |
| 54 | 0 | return arrow; |
| 55 | } | |
| 56 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |