/** * Get the image to include in the label for the given VisualItem. * @param item the item to get an image for * @return the image for the item, or null for no image */ protected Image getImage(VisualItem item) { String imageLoc = getImageLocation(item); return ( imageLoc == null ? null : m_images.getImage(imageLoc) ); }
/** * Creates a new ShapeRenderer with given base size. * @param size the base size in pixels */ public ShapeRenderer(int size) { setBaseSize(size); }
/** * Sets the maximum image dimensions, used to control scaling of loaded * images. This scaling is enforced immediately upon loading of the image. * @param width the maximum width of images (-1 for no limit) * @param height the maximum height of images (-1 for no limit) */ public void setMaxImageDimensions(int width, int height) { if ( m_images == null ) m_images = new ImageFactory(); m_images.setMaxImageDimensions(width, height); }
public static LabelRenderer labelRenderer() { LabelRenderer labelRenderer = new LabelRenderer(TITLE); labelRenderer.setMaxTextWidth(NODE_DIAMETER - TEXT_OVERLAP); return labelRenderer; }
public static ShapeRenderer nodeRenderer() { ShapeRenderer nodeRenderer = new ShapeRenderer(); nodeRenderer.setBaseSize(NODE_DIAMETER); return nodeRenderer; }
/** * Default Constructor. A ShapeRenderer instance will be used for the * default item renderer and an EdgeRenderer instance will be used for the * default edge renderer. * @see ShapeRenderer * @see EdgeRenderer */ public DefaultRendererFactory() { this(new ShapeRenderer()); }
/** * Constructor. Creates a new DefaultRendererFactory with the specified * default item renderer. An EdgeRenderer instance will be used for the * default edge renderer. * @param itemRenderer the default item renderer. This is the default for * rendering all items except EdgeItem instances. * @see EdgeRenderer */ public DefaultRendererFactory(Renderer itemRenderer) { this(itemRenderer, new EdgeRenderer()); }
/** * Create a new LabelRenderer. Draws a text label using the given text * data field, and draws the image at the location reported by the * given image data field. * @param textField the data field for the text label * @param imageField the data field for the image location. This value * in the data field should be a URL, a file within the current classpath, * a file on the filesystem, or null for no image. If the * <code>imageField</code> parameter is null, no images at all will be * drawn. */ public LabelRenderer(String textField, String imageField) { setTextField(textField); setImageField(imageField); }
public static EdgeRenderer edgeRenderer() { EdgeRenderer edgeRenderer = new CustomEdgeRenderer(EDGE_TYPE_LINE); edgeRenderer.setDefaultLineWidth(VisualizationParameters.EDGE_THICKNESS); edgeRenderer.setArrowHeadSize(10, 15); return edgeRenderer; } }
/** * Create a new LabelRenderer. Draws a text label using the given * text data field and does not draw an image. * @param textField the data field for the text label. */ public LabelRenderer(String textField) { this.setTextField(textField); }
/** * Create a new EdgeRenderer with the given edge and arrow types. * @param edgeType the edge type, one of * {@link prefuse.Constants#EDGE_TYPE_LINE} or * {@link prefuse.Constants#EDGE_TYPE_CURVE}. * @param arrowType the arrow type, one of * {@link prefuse.Constants#EDGE_ARROW_FORWARD}, * {@link prefuse.Constants#EDGE_ARROW_REVERSE}, or * {@link prefuse.Constants#EDGE_ARROW_NONE}. * @see #setArrowType(int) */ public EdgeRenderer(int edgeType, int arrowType) { this(); setEdgeType(edgeType); setArrowType(arrowType); }
/** * 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)); }
/** * Returns the image factory used by this renderer. * @return the image factory */ public ImageFactory getImageFactory() { if ( m_images == null ) m_images = new ImageFactory(); return m_images; }
/** * Create a new ImageFactory. This instance will scale loaded images * if they exceed the threshold arguments. * @param maxImageWidth the maximum width of input images * (-1 means no limit) * @param maxImageHeight the maximum height of input images * (-1 means no limit) */ public ImageFactory(int maxImageWidth, int maxImageHeight) { setMaxImageDimensions(maxImageWidth, maxImageHeight); }
public boolean removeEldestEntry(Map.Entry eldest) { return size() > m_imageCacheSize; } };
/** * Sets the dimensions of an arrow head for a directed edge. This specifies * the pixel dimensions when both the zoom level and the size factor * (a combination of item size value and default stroke width) are 1.0. * @param width the untransformed arrow head width, in pixels. This * specifies the span of the base of the arrow head. * @param height the untransformed arrow head height, in pixels. This * specifies the distance from the point of the arrow to its base. */ public void setArrowHeadSize(int width, int height) { m_arrowWidth = width; m_arrowHeight = height; m_arrowHead = updateArrowHead(width, height); }
/** * @see prefuse.visual.VisualItem#render(java.awt.Graphics2D) */ public void render(Graphics2D g) { getRenderer().render(g, this); }
public static LabelRenderer edgeLabelRenderer() { LabelRenderer labelRenderer = new LabelRenderer(TITLE); labelRenderer.setMaxTextWidth(NODE_DIAMETER - TEXT_OVERLAP); return labelRenderer; }
/** * Set the data field for image locations. The value stored * in the data field should be a URL, a file within the current classpath, * a file on the filesystem, or null for no image. If the * <code>imageField</code> parameter is null, no images at all will be * drawn. * @param imageField the data field for image locations, or null for * no images */ public void setImageField(String imageField) { if ( imageField != null ) m_images = new ImageFactory(); m_imageName = imageField; }