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 * Zoomable.java 029 * ------------- 030 * 031 * (C) Copyright 2004-present, by David Gilbert and Contributors. 032 * 033 * Original Author: David Gilbert; 034 * Contributor(s): Rune Fauske; 035 * 036 */ 037 038package org.jfree.chart.plot; 039 040import java.awt.geom.Point2D; 041 042import org.jfree.chart.ChartPanel; 043 044/** 045 * A plot that is zoomable must implement this interface to provide a 046 * mechanism for the {@link ChartPanel} to control the zooming. 047 */ 048public interface Zoomable { 049 050 /** 051 * Returns {@code true} if the plot's domain is zoomable, and {@code false} 052 * otherwise. 053 * 054 * @return A boolean. 055 * 056 * @see #isRangeZoomable() 057 */ 058 boolean isDomainZoomable(); 059 060 /** 061 * Returns {@code true} if the plot's range is zoomable, and {@code false} 062 * otherwise. 063 * 064 * @return A boolean. 065 * 066 * @see #isDomainZoomable() 067 */ 068 boolean isRangeZoomable(); 069 070 /** 071 * Returns the orientation of the plot. 072 * 073 * @return The orientation (never {@code null}). 074 */ 075 PlotOrientation getOrientation(); 076 077 /** 078 * Multiplies the range on the domain axis/axes by the specified factor. 079 * The {@code source} point can be used in some cases to identify a 080 * subplot, or to determine the center of zooming (refer to the 081 * documentation of the implementing class for details). 082 * 083 * @param factor the zoom factor. 084 * @param state the plot state. 085 * @param source the source point (in Java2D coordinates). 086 * 087 * @see #zoomRangeAxes(double, PlotRenderingInfo, Point2D) 088 */ 089 void zoomDomainAxes(double factor, PlotRenderingInfo state, 090 Point2D source); 091 092 /** 093 * Multiplies the range on the domain axis/axes by the specified factor. 094 * The {@code source} point can be used in some cases to identify a 095 * subplot, or to determine the center of zooming (refer to the 096 * documentation of the implementing class for details). 097 * 098 * @param factor the zoom factor. 099 * @param state the plot state. 100 * @param source the source point (in Java2D coordinates). 101 * @param useAnchor use source point as zoom anchor? 102 * 103 * @see #zoomRangeAxes(double, PlotRenderingInfo, Point2D, boolean) 104 */ 105 void zoomDomainAxes(double factor, PlotRenderingInfo state, 106 Point2D source, boolean useAnchor); 107 108 /** 109 * Zooms in on the domain axes. The {@code source} point can be used 110 * in some cases to identify a subplot for zooming. 111 * 112 * @param lowerPercent the new lower bound. 113 * @param upperPercent the new upper bound. 114 * @param state the plot state. 115 * @param source the source point (in Java2D coordinates). 116 * 117 * @see #zoomRangeAxes(double, double, PlotRenderingInfo, Point2D) 118 */ 119 void zoomDomainAxes(double lowerPercent, double upperPercent, 120 PlotRenderingInfo state, Point2D source); 121 122 /** 123 * Multiplies the range on the range axis/axes by the specified factor. 124 * The {@code source} point can be used in some cases to identify a 125 * subplot, or to determine the center of zooming (refer to the 126 * documentation of the implementing class for details). 127 * 128 * @param factor the zoom factor. 129 * @param state the plot state. 130 * @param source the source point (in Java2D coordinates). 131 * 132 * @see #zoomDomainAxes(double, PlotRenderingInfo, Point2D) 133 */ 134 void zoomRangeAxes(double factor, PlotRenderingInfo state, 135 Point2D source); 136 137 /** 138 * Multiplies the range on the range axis/axes by the specified factor. 139 * The {@code source} point can be used in some cases to identify a 140 * subplot, or to determine the center of zooming (refer to the 141 * documentation of the implementing class for details). 142 * 143 * @param factor the zoom factor. 144 * @param state the plot state. 145 * @param source the source point (in Java2D coordinates). 146 * @param useAnchor use source point as zoom anchor? 147 * 148 * @see #zoomDomainAxes(double, PlotRenderingInfo, Point2D) 149 */ 150 void zoomRangeAxes(double factor, PlotRenderingInfo state, 151 Point2D source, boolean useAnchor); 152 153 /** 154 * Zooms in on the range axes. The {@code source} point can be used 155 * in some cases to identify a subplot for zooming. 156 * 157 * @param lowerPercent the new lower bound. 158 * @param upperPercent the new upper bound. 159 * @param state the plot state. 160 * @param source the source point (in Java2D coordinates). 161 * 162 * @see #zoomDomainAxes(double, double, PlotRenderingInfo, Point2D) 163 */ 164 void zoomRangeAxes(double lowerPercent, double upperPercent, 165 PlotRenderingInfo state, Point2D source); 166 167}