001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
005: * (C) 2004, Institut de Recherche pour le Développement
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation;
010: * version 2.1 of the License.
011: *
012: * This library 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 GNU
015: * Lesser General Public License for more details.
016: *
017: * This package contains documentation from OpenGIS specifications.
018: * OpenGIS consortium's work is fully acknowledged here.
019: */
020: package org.geotools.metadata.iso.content;
021:
022: // J2SE dependencies
023: import java.util.Collection;
024: import java.util.Collections;
025: import java.util.Map;
026: import java.util.Set;
027:
028: // OpenGIS dependencies
029: import org.opengis.metadata.content.CoverageContentType;
030: import org.opengis.metadata.content.CoverageDescription;
031: import org.opengis.metadata.content.RangeDimension;
032: import org.opengis.util.MemberName;
033: import org.opengis.util.Record;
034: import org.opengis.util.RecordSchema;
035: import org.opengis.util.RecordType;
036: import org.opengis.util.TypeName;
037:
038: /**
039: * Information about the content of a grid data cell.
040: *
041: * @since 2.1
042: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/main/java/org/geotools/metadata/iso/content/CoverageDescriptionImpl.java $
043: * @version $Id: CoverageDescriptionImpl.java 25193 2007-04-18 13:37:38Z desruisseaux $
044: * @author Martin Desruisseaux
045: * @author Touraïvane
046: */
047: public class CoverageDescriptionImpl extends ContentInformationImpl
048: implements CoverageDescription {
049: /**
050: * Serial number for interoperability with different versions.
051: */
052: private static final long serialVersionUID = -326050615789333559L;;
053:
054: /**
055: * Description of the attribute described by the measurement value.
056: */
057: private RecordType attributeDescription;
058:
059: /**
060: * Type of information represented by the cell value.
061: */
062: private CoverageContentType contentType;
063:
064: /**
065: * Information on the dimensions of the cell measurement value.
066: */
067: private Collection dimensions;
068:
069: /**
070: * Constructs an empty coverage description.
071: */
072: public CoverageDescriptionImpl() {
073: }
074:
075: /**
076: * Constructs a metadata entity initialized with the values from the specified metadata.
077: *
078: * @since 2.4
079: */
080: public CoverageDescriptionImpl(final CoverageDescription source) {
081: super (source);
082: }
083:
084: /**
085: * Returns the description of the attribute described by the measurement value.
086: */
087: public RecordType getAttributeDescription() {
088: return attributeDescription;
089: }
090:
091: /**
092: * Set the description of the attribute described by the measurement value.
093: */
094: public synchronized void setAttributeDescription(
095: final RecordType newValue) {
096: checkWritePermission();
097: attributeDescription = newValue;
098: }
099:
100: /**
101: * Returns the type of information represented by the cell value.
102: */
103: public CoverageContentType getContentType() {
104: return contentType;
105: }
106:
107: /**
108: * Set the type of information represented by the cell value.
109: */
110: public synchronized void setContentType(
111: final CoverageContentType newValue) {
112: checkWritePermission();
113: contentType = newValue;
114: }
115:
116: /**
117: * Returns the information on the dimensions of the cell measurement value.
118: *
119: * @deprecated use {@link #getDimensions}
120: */
121: public RangeDimension getDimension() {
122: final Collection dimensions = getDimensions();
123: return dimensions.isEmpty() ? null
124: : (RangeDimension) dimensions.iterator().next();
125: }
126:
127: /**
128: * Set the information on the dimensions of the cell measurement value.
129: *
130: * @deprecated use {@link #setDimensions}
131: */
132: public synchronized void setDimension(final RangeDimension newValue) {
133: setDimensions(java.util.Collections.singleton(newValue));
134: }
135:
136: /**
137: * Returns the information on the dimensions of the cell measurement value.
138: *
139: * @since 2.4
140: */
141: public synchronized Collection getDimensions() {
142: return dimensions = nonNullCollection(dimensions,
143: RangeDimension.class);
144: }
145:
146: /**
147: * Set the information on the dimensions of the cell measurement value.
148: *
149: * since 2.4
150: */
151: public synchronized void setDimensions(final Collection newValues) {
152: dimensions = copyCollection(newValues, dimensions,
153: RangeDimension.class);
154: }
155: }
|