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