01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2004, Institut de Recherche pour le Développement
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * This package contains documentation from OpenGIS specifications.
18: * OpenGIS consortium's work is fully acknowledged here.
19: */
20: package org.geotools.metadata.iso.extent;
21:
22: // J2Se dependencies
23: import java.util.Collection;
24:
25: // OpenGIS dependencies
26: import org.opengis.metadata.extent.BoundingPolygon;
27: import org.opengis.geometry.Geometry;
28:
29: /**
30: * Boundary enclosing the dataset, expressed as the closed set of
31: * (<var>x</var>,<var>y</var>) coordinates of the polygon. The last
32: * point replicates first point.
33: *
34: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/main/java/org/geotools/metadata/iso/extent/BoundingPolygonImpl.java $
35: * @version $Id: BoundingPolygonImpl.java 25189 2007-04-17 13:23:47Z desruisseaux $
36: * @author Martin Desruisseaux
37: * @author Touraïvane
38: *
39: * @since 2.1
40: */
41: public class BoundingPolygonImpl extends GeographicExtentImpl implements
42: BoundingPolygon {
43: /**
44: * Serial number for interoperability with different versions.
45: */
46: private static final long serialVersionUID = 8174011874910887918L;
47:
48: /**
49: * The sets of points defining the bounding polygon.
50: */
51: private Collection/*<Geometry>*/polygons;
52:
53: /**
54: * Constructs an initially empty bounding polygon.
55: */
56: public BoundingPolygonImpl() {
57: }
58:
59: /**
60: * Constructs a metadata entity initialized with the values from the specified metadata.
61: *
62: * @since 2.4
63: */
64: public BoundingPolygonImpl(final BoundingPolygon source) {
65: super (source);
66: }
67:
68: /**
69: * Creates a bounding polygon initialized to the specified value.
70: */
71: public BoundingPolygonImpl(final Collection/*<Geometry>*/polygons) {
72: setPolygons(polygons);
73: }
74:
75: /**
76: * Returns the sets of points defining the bounding polygon.
77: */
78: public synchronized Collection/*<Geometry>*/getPolygons() {
79: return polygons = nonNullCollection(polygons, Geometry.class);
80: }
81:
82: /**
83: * Set the sets of points defining the bounding polygon.
84: */
85: public synchronized void setPolygons(
86: final Collection/*<Geometry>*/newValues) {
87: polygons = copyCollection(newValues, polygons, Geometry.class);
88: }
89: }
|