/*
 * @(#)ScaleFactorConstraints.java  1.3  2006-07-23
 *
 * Copyright (c) 1999-2006 Werner Randelshofer, Immensee, Switzerland.
 * All rights reserved.
 *
 * You may not use, copy or modify this file, except in compliance with the
 * license agreement you entered into with Werner Randelshofer.
 * For details see accompanying license terms.
 */
package ch.randelshofer.gui;

import java.awt.*;
/**
 * The ScaleFactorConstraints class specifies constraints for
 * components that are laid out using the ScaleFactorLayout class.
 *
 * @author  Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland
 * @version 1.3 2006-07-23 Support for Pixel Aspect Ratio added. 
 * <br>1.2 2002-02-06 'Scale to fit' property added.
 * <br>1.1 2000-09-27 Setter for factorX, factorY and maintainAspectRatio added.
 * <br>1.0.1   2000-06-12 Reworked.
 * <br>1.0  1999-10-19
 */
public class ScaleFactorConstraints {
    public double factorX = 1.0;
    public double factorY = 1.0;
    
    /**
     * Pixel width divided by pixel height.
     * 1.0 is quadratic.
     */
    public double pixelAspectRatio = 1d;
    
    public boolean maintainAspectRatio = true;
    public boolean scaleToFit = true;

    /**
     * Creates a ScaleFactorConstraints object with all of its
     * set to the default values.
     */
    public ScaleFactorConstraints() {
    }

    /**
     * Creates a ScaleFactorConstraints object with all of its
     * fields set to the passed-in arguments.
     *
     * @param factorX   the scale factor for the x axis of the component.
     * @param factorY   the scale factor for the y axis of the component.
     * @param maintainAspectRatio   set to true if the aspect ratio of the
     *                  component shall be maintained.
     */
    public ScaleFactorConstraints(double factorX, double factorY, boolean maintainAspectRatio) {
        this.factorX = factorX;
        this.factorY = factorY;
        this.maintainAspectRatio = maintainAspectRatio;
    }

    public void setConstraints(double factorX, double factorY, boolean maintainAspectRatio) {
        this.factorX = factorX;
        this.factorY = factorY;
        this.maintainAspectRatio = maintainAspectRatio;
    }

    public double getFactorX() {
        return factorX;
    }

    public double getFactorY() {
        return factorY;
    }

    public void setFactorX(double d) {
        factorX = d;
    }

    public void setFactorY(double d) {
        factorY = d;
    }
    
    public void setPixelAspectRatio(double d) {
        pixelAspectRatio = d;
    }
    public double getPixelAspectRatio() {
        return pixelAspectRatio;
    }
    
    public boolean isMaintainAspectRatio() {
        return maintainAspectRatio;
    }
    public void setMaintainAspectRatio(boolean b) {
        maintainAspectRatio = b;
    }
    public boolean isScaleToFit() {
        return scaleToFit;
    }
    public void setScaleToFit(boolean b) {
        scaleToFit = b;
    }
}
