001/* =========================================================== 002 * JFreeChart : a free chart library for the Java(tm) platform 003 * =========================================================== 004 * 005 * (C) Copyright 2000-2013, by Object Refinery Limited 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-2008, by Object Refinery Limited. 031 * 032 * Original Author: David Gilbert (for Object Refinery Limited); 033 * Contributor(s): -; 034 * 035 * Changes: 036 * -------- 037 * 19-Apr-2005 : Version 1 (DG); 038 * 039 */ 040 041package org.jfree.chart.block; 042 043/** 044 * A standard parameter object that can be passed to the draw() method defined 045 * by the {@link Block} class. 046 */ 047public class BlockParams implements EntityBlockParams { 048 049 /** 050 * A flag that controls whether or not the block should generate and 051 * return chart entities for the items it draws. 052 */ 053 private boolean generateEntities; 054 055 /** 056 * The x-translation (used to enable chart entities to use global 057 * coordinates rather than coordinates that are local to the container 058 * they are within). 059 */ 060 private double translateX; 061 062 /** 063 * The y-translation (used to enable chart entities to use global 064 * coordinates rather than coordinates that are local to the container 065 * they are within). 066 */ 067 private double translateY; 068 069 /** 070 * Creates a new instance. 071 */ 072 public BlockParams() { 073 this.translateX = 0.0; 074 this.translateY = 0.0; 075 this.generateEntities = false; 076 } 077 078 /** 079 * Returns the flag that controls whether or not chart entities are 080 * generated. 081 * 082 * @return A boolean. 083 */ 084 @Override 085 public boolean getGenerateEntities() { 086 return this.generateEntities; 087 } 088 089 /** 090 * Sets the flag that controls whether or not chart entities are generated. 091 * 092 * @param generate the flag. 093 */ 094 public void setGenerateEntities(boolean generate) { 095 this.generateEntities = generate; 096 } 097 098 /** 099 * Returns the translation required to convert local x-coordinates back to 100 * the coordinate space of the container. 101 * 102 * @return The x-translation amount. 103 */ 104 public double getTranslateX() { 105 return this.translateX; 106 } 107 108 /** 109 * Sets the translation required to convert local x-coordinates into the 110 * coordinate space of the container. 111 * 112 * @param x the x-translation amount. 113 */ 114 public void setTranslateX(double x) { 115 this.translateX = x; 116 } 117 118 /** 119 * Returns the translation required to convert local y-coordinates back to 120 * the coordinate space of the container. 121 * 122 * @return The y-translation amount. 123 */ 124 public double getTranslateY() { 125 return this.translateY; 126 } 127 128 /** 129 * Sets the translation required to convert local y-coordinates into the 130 * coordinate space of the container. 131 * 132 * @param y the y-translation amount. 133 */ 134 public void setTranslateY(double y) { 135 this.translateY = y; 136 } 137 138}