1 /* File Domain2D.java 2 * 3 * Project : Java Geometry Library 4 * 5 * =========================================== 6 * 7 * This library is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU Lesser General Public License as published by 9 * the Free Software Foundation, either version 2.1 of the License, or (at 10 * your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY 14 * or FITNESS FOR A PARTICULAR PURPOSE. 15 * 16 * See the GNU Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public License 19 * along with this library. if not, write to : 20 * The Free Software Foundation, Inc., 59 Temple Place, Suite 330, 21 * Boston, MA 02111-1307, USA. 22 */ 23 24 // package 25 26 package math.geom2d.domain; 27 28 import java.awt.Graphics2D; 29 30 import math.geom2d.AffineTransform2D; 31 import math.geom2d.Box2D; 32 import math.geom2d.Shape2D; 33 34 // Imports 35 36 /** 37 * Interface for shapes that draws an 'interior' and an 'exterior'. An 38 * AbstractDomain2D can be defined with a non-self intersecting set of Curve2D, 39 * and contains all points lying 'on the left' of the parent curve. 40 * <p> 41 * Some Shape may seem very similar, for example Conic2D and ConicCurve2D. The 42 * reason is that a point can be contained in a Conic2D but not in the 43 * ConicCurve2D. 44 */ 45 public interface Domain2D extends Shape2D { 46 47 /** 48 * Returns the boundary of the set. This boundary is either a continuous non 49 * intersecting curve (connected domain), or a set of non intersecting 50 * continuous curve (one continuous non-intersection for each connected part 51 * of the domain). 52 * <p> 53 * The returned curve is oriented, with an interior and an exterior. 54 * 55 * @return the boundary of the domain 56 */ 57 public abstract Boundary2D getBoundary(); 58 59 /** 60 * Returns the domain which complements this domain in the plane. 61 * 62 * @return the complement of this domain. 63 * @since 0.6.3 64 */ 65 public abstract Domain2D complement(); 66 67 public abstract Domain2D transform(AffineTransform2D transform); 68 69 public abstract Domain2D clip(Box2D box); 70 71 /** 72 * Draws the boundary of the domain, using current Stroke and color. 73 * 74 * @param g2 the Graphics to draw on 75 * @since 0.6.3 76 */ 77 public abstract void draw(Graphics2D g2); 78 79 /** 80 * Fills the interior of the domain, using the Graphics current Paint. 81 * 82 * @param g2 the Graphics to fill on 83 * @since 0.6.3 84 */ 85 public abstract void fill(Graphics2D g2); 86 87 }