public static Element makeArrow ( SVGPlot svgp , Direction dir , double x , double y , double size ) { final double hs = size / 2. ; switch ( dir ) { case LEFT : return new SVGPath ( ) . drawTo ( x + hs , y + hs ) . drawTo ( x - hs , y ) . drawTo ( x + hs , y - hs ) . drawTo ( x + hs , y + hs ) . close ( ) . makeElement ( svgp ) ; case DOWN : return new SVGPath ( ) . drawTo ( x - hs , y - hs ) . drawTo ( x + hs , y - hs ) . drawTo ( x , y + hs ) . drawTo ( x - hs , y - hs ) . close ( ) . makeElement ( svgp ) ; case RIGHT : return new SVGPath ( ) . drawTo ( x - hs , y - hs ) . drawTo ( x + hs , y ) . drawTo ( x - hs , y + hs ) . drawTo ( x - hs , y - hs ) . close ( ) . makeElement ( svgp ) ; case UP : return new SVGPath ( ) . drawTo ( x - hs , y + hs ) . drawTo ( x , y - hs ) . drawTo ( x + hs , y + hs ) . drawTo ( x - hs , y + hs ) . close ( ) . makeElement ( svgp ) ; default : throw new IllegalArgumentException ( "Unexpected direction: " + dir ) ; } }
Draw an arrow at the given position .