01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.tools.edit.impl;
16:
17: import java.awt.geom.Ellipse2D;
18: import java.awt.geom.GeneralPath;
19:
20: import net.refractions.udig.tools.edit.behaviour.ShapeCreationBehaviour;
21: import net.refractions.udig.tools.edit.behaviour.ShapeCreationBehaviour.ShapeFactory;
22:
23: /**
24: * Draws and adds ellipses to a layer.
25: *
26: * @author jones
27: * @since 1.1.0
28: */
29: public class EllipseTool extends RectangleTool {
30: @Override
31: protected ShapeFactory getShapeFactory() {
32: return new ShapeCreationBehaviour.ShapeFactory() {
33:
34: @Override
35: public GeneralPath create(int width, int height) {
36: GeneralPath path = new GeneralPath();
37: path.append(new Ellipse2D.Float(0, 0, width, height),
38: false);
39: return path;
40: }
41:
42: };
43: }
44: }
|