001: /*
002: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
003: * for visualizing and manipulating spatial features with geometry and attributes.
004: *
005: * Copyright (C) 2003 Vivid Solutions
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: *
021: * For more information, contact:
022: *
023: * Vivid Solutions
024: * Suite #1A
025: * 2328 Government Street
026: * Victoria BC V8T 5G5
027: * Canada
028: *
029: * (250)385-6040
030: * www.vividsolutions.com
031: */
032:
033: package com.vividsolutions.jump.workbench.ui.renderer.java2D;
034:
035: import java.awt.Rectangle;
036: import java.awt.Shape;
037: import java.awt.geom.AffineTransform;
038: import java.awt.geom.PathIterator;
039: import java.awt.geom.Point2D;
040: import java.awt.geom.Rectangle2D;
041: import java.util.ArrayList;
042: import java.util.Iterator;
043:
044: import com.vividsolutions.jump.I18N;
045:
046: /**
047: *
048: * @TODO :I18N to finish
049: */
050:
051: public class GeometryCollectionShape implements Shape {
052: private ArrayList shapes = new ArrayList();
053:
054: public GeometryCollectionShape() {
055: }
056:
057: public void add(Shape shape) {
058: shapes.add(shape);
059: }
060:
061: public Rectangle getBounds() {
062: /**@todo Implement this java.awt.Shape method*/
063: throw new java.lang.UnsupportedOperationException(
064: I18N
065: .get("ui.renderer.GeometryCollectionShape.method-getBounds-not-yet-implemented"));
066: }
067:
068: public Rectangle2D getBounds2D() {
069: Rectangle2D rectangle = null;
070:
071: for (Iterator i = shapes.iterator(); i.hasNext();) {
072: Shape shape = (Shape) i.next();
073:
074: if (rectangle == null) {
075: rectangle = shape.getBounds2D();
076: } else {
077: rectangle.add(shape.getBounds2D());
078: }
079: }
080:
081: return rectangle;
082: }
083:
084: public boolean contains(double x, double y) {
085: /**@todo Implement this java.awt.Shape method*/
086: throw new java.lang.UnsupportedOperationException(
087: I18N
088: .get("ui.renderer.GeometryCollectionShape.method-contains-not-yet-implemented"));
089: }
090:
091: public boolean contains(Point2D p) {
092: /**@todo Implement this java.awt.Shape method*/
093: throw new java.lang.UnsupportedOperationException(
094: I18N
095: .get("ui.renderer.GeometryCollectionShape.method-contains-not-yet-implemented"));
096: }
097:
098: public boolean intersects(double x, double y, double w, double h) {
099: /**@todo Implement this java.awt.Shape method*/
100: throw new java.lang.UnsupportedOperationException(
101: "Method intersects() not yet implemented.");
102: }
103:
104: public boolean intersects(Rectangle2D r) {
105: /**@todo Implement this java.awt.Shape method*/
106: throw new java.lang.UnsupportedOperationException(
107: "Method intersects() not yet implemented.");
108: }
109:
110: public boolean contains(double x, double y, double w, double h) {
111: /**@todo Implement this java.awt.Shape method*/
112: throw new java.lang.UnsupportedOperationException(
113: "Method contains() not yet implemented.");
114: }
115:
116: public boolean contains(Rectangle2D r) {
117: /**@todo Implement this java.awt.Shape method*/
118: throw new java.lang.UnsupportedOperationException(
119: "Method contains() not yet implemented.");
120: }
121:
122: public PathIterator getPathIterator(AffineTransform at) {
123: return new ShapeCollectionPathIterator(shapes, at);
124: }
125:
126: public PathIterator getPathIterator(AffineTransform at,
127: double flatness) {
128: // since we don't support curved geometries, can simply delegate to the simple method
129: return getPathIterator(at);
130: }
131: }
|