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.identification;
021:
022: // OpenGIS dependencies
023: import org.opengis.metadata.identification.RepresentativeFraction;
024: import org.opengis.metadata.identification.Resolution;
025:
026: // Geotools dependencies
027: import org.geotools.metadata.iso.MetadataEntity;
028:
029: /**
030: * Level of detail expressed as a scale factor or a ground distance.
031: *
032: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/main/java/org/geotools/metadata/iso/identification/ResolutionImpl.java $
033: * @version $Id: ResolutionImpl.java 25189 2007-04-17 13:23:47Z desruisseaux $
034: * @author Martin Desruisseaux
035: * @author Touraïvane
036: *
037: * @since 2.1
038: */
039: public class ResolutionImpl extends MetadataEntity implements
040: Resolution {
041: /**
042: * Serial number for compatibility with different versions.
043: */
044: private static final long serialVersionUID = -4644465057871958482L;
045:
046: /**
047: * Level of detail expressed as the scale of a comparable hardcopy map or chart.
048: * This value should be between 0 and 1.
049: * Only one of {@linkplain #getEquivalentScale equivalent scale} and
050: * {@linkplain #getDistance ground sample distance} may be provided.
051: */
052: private RepresentativeFraction equivalentScale;
053:
054: /**
055: * Ground sample distance.
056: * Only one of {@linkplain #getEquivalentScale equivalent scale} and
057: * {@linkplain #getDistance ground sample distance} may be provided.
058: */
059: private Double distance;
060:
061: /**
062: * Constructs an initially empty Resolution.
063: */
064: public ResolutionImpl() {
065: }
066:
067: /**
068: * Constructs a metadata entity initialized with the values from the specified metadata.
069: *
070: * @since 2.4
071: */
072: public ResolutionImpl(final Resolution source) {
073: super (source);
074: }
075:
076: /**
077: * Level of detail expressed as the scale of a comparable hardcopy map or chart.
078: * Only one of {@linkplain #getEquivalentScale equivalent scale} and
079: * {@linkplain #getDistance ground sample distance} may be provided.
080: */
081: public RepresentativeFraction getEquivalentScale() {
082: return equivalentScale;
083: }
084:
085: /**
086: * Set the level of detail expressed as the scale of a comparable hardcopy map or chart.
087: *
088: * Values greater than 1 will be stored as (1 / newValue), values less than one will be stored as is.
089: *
090: * @deprecated Replaced by {@link #setEquivalentScale(RepresentativeFraction)}.
091: */
092: public void setEquivalentScale(final double newValue) {
093: setEquivalentScale(RepresentativeFractionImpl
094: .fromScale(newValue));
095: }
096:
097: /**
098: * Set the level of detail expressed as the scale of a comparable hardcopy map or chart.
099: *
100: * @since 2.4
101: */
102: public synchronized void setEquivalentScale(
103: final RepresentativeFraction newValue) {
104: checkWritePermission();
105: equivalentScale = newValue;
106: }
107:
108: /**
109: * Ground sample distance.
110: * Only one of {@linkplain #getEquivalentScale equivalent scale} and
111: * {@linkplain #getDistance ground sample distance} may be provided.
112: */
113: public Double getDistance() {
114: return distance;
115: }
116:
117: /**
118: * Set the ground sample distance.
119: */
120: public synchronized void setDistance(final Double newValue) {
121: checkWritePermission();
122: distance = newValue;
123: }
124: }
|