001/* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-present, by David Gilbert and Contributors.
006 *
007 * Project Info:  http://www.jfree.org/jfreechart/index.html
008 *
009 * This library is free software; you can redistribute it and/or modify it
010 * under the terms of the GNU Lesser General Public License as published by
011 * the Free Software Foundation; either version 2.1 of the License, or
012 * (at your option) any later version.
013 *
014 * This library is distributed in the hope that it will be useful, but
015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017 * License for more details.
018 *
019 * You should have received a copy of the GNU Lesser General Public
020 * License along with this library; if not, write to the Free Software
021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
022 * USA.
023 *
024 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
025 * Other names may be trademarks of their respective owners.]
026 *
027 * ----------------
028 * BlockParams.java
029 * ----------------
030 * (C) Copyright 2005-present, by David Gilbert.
031 *
032 * Original Author:  David Gilbert;
033 * Contributor(s):   -;
034 *
035 */
036
037package org.jfree.chart.block;
038
039/**
040 * A standard parameter object that can be passed to the draw() method defined
041 * by the {@link Block} class.
042 */
043public class BlockParams implements EntityBlockParams {
044
045    /**
046     * A flag that controls whether or not the block should generate and
047     * return chart entities for the items it draws.
048     */
049    private boolean generateEntities;
050
051    /**
052     * The x-translation (used to enable chart entities to use global
053     * coordinates rather than coordinates that are local to the container
054     * they are within).
055     */
056    private double translateX;
057
058    /**
059     * The y-translation (used to enable chart entities to use global
060     * coordinates rather than coordinates that are local to the container
061     * they are within).
062     */
063    private double translateY;
064
065    /**
066     * Creates a new instance.
067     */
068    public BlockParams() {
069        this.translateX = 0.0;
070        this.translateY = 0.0;
071        this.generateEntities = false;
072    }
073
074    /**
075     * Returns the flag that controls whether or not chart entities are
076     * generated.
077     *
078     * @return A boolean.
079     */
080    @Override
081    public boolean getGenerateEntities() {
082        return this.generateEntities;
083    }
084
085    /**
086     * Sets the flag that controls whether or not chart entities are generated.
087     *
088     * @param generate  the flag.
089     */
090    public void setGenerateEntities(boolean generate) {
091        this.generateEntities = generate;
092    }
093
094    /**
095     * Returns the translation required to convert local x-coordinates back to
096     * the coordinate space of the container.
097     *
098     * @return The x-translation amount.
099     */
100    public double getTranslateX() {
101        return this.translateX;
102    }
103
104    /**
105     * Sets the translation required to convert local x-coordinates into the
106     * coordinate space of the container.
107     *
108     * @param x  the x-translation amount.
109     */
110    public void setTranslateX(double x) {
111        this.translateX = x;
112    }
113
114    /**
115     * Returns the translation required to convert local y-coordinates back to
116     * the coordinate space of the container.
117     *
118     * @return The y-translation amount.
119     */
120    public double getTranslateY() {
121        return this.translateY;
122    }
123
124    /**
125     * Sets the translation required to convert local y-coordinates into the
126     * coordinate space of the container.
127     *
128     * @param y  the y-translation amount.
129     */
130    public void setTranslateY(double y) {
131        this.translateY = y;
132    }
133
134}