/*
 * Created on Jul 16, 2004
 *
 * Copyright (c) 2004, The JUNG Authors 
 *
 * All rights reserved.
 *
 * This software is open-source under the BSD license; see either
 * "license.txt" or
 * https://github.com/jrtom/jung/blob/master/LICENSE for a description.
 */
package edu.uci.ics.jung.visualization.decorators;

import com.google.common.base.Function;
import com.google.common.base.Functions;

import edu.uci.ics.jung.visualization.util.VertexShapeFactory;



/**
 * 
 * @author Joshua O'Madadhain
 */
public abstract class AbstractVertexShapeTransformer implements SettableVertexShapeTransformer
{
    protected Function vsf;
    protected Function varf;
    protected VertexShapeFactory factory;
    public final static int DEFAULT_SIZE = 8;
    public final static float DEFAULT_ASPECT_RATIO = 1.0f;
    
    public AbstractVertexShapeTransformer(Function vsf, Function varf)
    {
        this.vsf = vsf;
        this.varf = varf;
        factory = new VertexShapeFactory(vsf, varf);
    }

	public AbstractVertexShapeTransformer()
    {
        this(Functions.constant(DEFAULT_SIZE), 
                Functions.constant(DEFAULT_ASPECT_RATIO));
    }
    
    public void setSizeTransformer(Function vsf)
    {
        this.vsf = vsf;
        factory = new VertexShapeFactory(vsf, varf);
    }
    
    public void setAspectRatioTransformer(Function varf)
    {
        this.varf = varf;
        factory = new VertexShapeFactory(vsf, varf);
    }
}

 

Ads help maintain this website.