/** * Returns the shape describing the boundary of an item. The shape's * coordinates should be in absolute (item-space) coordinates. * @param item the item for which to get the Shape */ public Shape getShape(VisualItem item) { AffineTransform at = getTransform(item); Shape rawShape = getRawShape(item); return (at==null || rawShape==null ? rawShape : at.createTransformedShape(rawShape)); }
/** * Draws the specified shape into the provided Graphics context, using * stroke and fill color values from the specified VisualItem. This method * can be called by subclasses in custom rendering routines. */ protected void drawShape(Graphics2D g, VisualItem item, Shape shape) { GraphicsLib.paint(g, item, shape, getStroke(item), getRenderType(item)); }
/** * @see prefuse.render.Renderer#setBounds(prefuse.visual.VisualItem) */ public void setBounds(VisualItem item) { if ( !m_manageBounds ) return; Shape shape = getShape(item); if ( shape == null ) { item.setBounds(item.getX(), item.getY(), 0, 0); } else { GraphicsLib.setBounds(item, shape, getStroke(item)); } }
/** * @see prefuse.render.Renderer#render(java.awt.Graphics2D, prefuse.visual.VisualItem) */ public void render(Graphics2D g, VisualItem item) { // render the edge line super.render(g, item); // render the edge arrow head, if appropriate if ( m_curArrow != null ) { g.setPaint(ColorLib.getColor(item.getFillColor())); g.fill(m_curArrow); } }
/** * @see prefuse.render.Renderer#locatePoint(java.awt.geom.Point2D, prefuse.visual.VisualItem) */ public boolean locatePoint(Point2D p, VisualItem item) { if ( item.getBounds().contains(p) ) { // if within bounds, check within shape outline Shape s = getShape(item); return (s != null ? s.contains(p) : false); } else { return false; } }