DefaultVerticalExtent changes for revisions 24867:24990

Replacement of primitive double type by the Double wrapper. This change has been forced by a GeoAPI change. Reverting this change causes a compilation failure, which is resolved by restoring the Double values as required by GeoAPI interfaces. So rewriting this contribution produces identical result.

This commit adds an empty skeleton for new method added in GeoAPI interface (getVerticalCRS()), but no implementation. Removing this contribution causes compilation error, which is solved by adding the method back. SIS provides a more complete implementation.

Contains also an update of the equals(Object) method more complicated than needed given the nature of the Double objects. This method has been rewritten in Geotk/SIS.

Action: all contributions forced by changes in GeoAPI interfaces (mostly import statements and method signatures) have been rewritten from scratch by creating an empty Java class implementing the interface, clicking on the "Implement all abstract methods" contextual menu in NetBeans, removing the <? extends> part in parameterized type of collections, adding the synchronized keyword (for now) and finally adding the corresponding private fields. This action has been committed in the Apache SIS JDK7 branch at revision 1458238.

Command line:

svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r24867:24990 https://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/iso/extent/VerticalExtentImpl.java
Revision 24867Revision 24990
// OpenGIS dependencies
import org.opengis.metadata.extent.VerticalExtent;
import org.opengis.referencing.datum.VerticalDatum;

// Geotools dependencies
// OpenGIS dependencies
import org.opengis.metadata.extent.VerticalExtent;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.datum.VerticalDatum;

// Geotools dependencies
/**
 * The lowest vertical extent contained in the dataset.
 */
private double minimumValue;

/**
 * The highest vertical extent contained in the dataset.
 */
private double maximumValue;

/**
 * The vertical units used for vertical extent information.
/**
 * The lowest vertical extent contained in the dataset.
 */
private Double minimumValue;

/**
 * The highest vertical extent contained in the dataset.
 */
private Double maximumValue;

/**
 * The vertical units used for vertical extent information.
/**
 * Provides information about the origin from which the
 * maximum and minimum elevation values are measured.
 */
private VerticalDatum verticalDatum;
/**
 * Provides information about the origin from which the
 * maximum and minimum elevation values are measured.
 * @deprecated
 */
private VerticalDatum verticalDatum;
/**
 * Creates a vertical extent initialized to the specified values.
 */
public VerticalExtentImpl(final double minimumValue,
                      final double maximumValue,
                      final Unit   unit,
                      final VerticalDatum verticalDatum)
{
/**
 * Creates a vertical extent initialized to the specified values.
 */
public VerticalExtentImpl(final Double minimumValue,
                      final Double maximumValue,
                      final Unit   unit,
                      final VerticalDatum verticalDatum)
{
}

/**
 * Returns the lowest vertical extent contained in the dataset.
 */
public double getMinimumValue() {
    return minimumValue;
}

/**
 * Set the lowest vertical extent contained in the dataset.
 */
public synchronized void setMinimumValue(final double newValue) {
    checkWritePermission();
    minimumValue = newValue;
}
}

/**
 * Creates a vertical extent initialized to the specified values.
 */
public VerticalExtentImpl(final double minimumValue,
                      final double maximumValue,
                      final Unit   unit,
                      final VerticalDatum verticalDatum)
{
    setMinimumValue (new Double(minimumValue));
    setMaximumValue (new Double(maximumValue));
    setUnit         (unit);
    setVerticalDatum(verticalDatum);
}

/**
 * Returns the lowest vertical extent contained in the dataset.
 */
public Double getMinimumValue() {
    return minimumValue;
}

/**
 * Set the lowest vertical extent contained in the dataset.
 */
public synchronized void setMinimumValue(final Double newValue) {
    checkWritePermission();
    minimumValue = newValue;
}
/**
 * Returns the highest vertical extent contained in the dataset.
 */
public double getMaximumValue() {
    return maximumValue;
}

/**
 * Set the highest vertical extent contained in the dataset.
 */
public synchronized void setMaximumValue(final double newValue) {
    checkWritePermission();
    maximumValue = newValue;
}
/**
 * Returns the highest vertical extent contained in the dataset.
 */
public Double getMaximumValue() {
    return maximumValue;
}

/**
 * Set the highest vertical extent contained in the dataset.
 */
public synchronized void setMaximumValue(final Double newValue) {
    checkWritePermission();
    maximumValue = newValue;
}
/**
 * Provides information about the origin from which the
 * maximum and minimum elevation values are measured.
 */
public VerticalDatum getVerticalDatum()  {
    return verticalDatum;
/**
 * Provides information about the origin from which the
 * maximum and minimum elevation values are measured.
 *
 * @deprecated use getVerticalCRS
 */
public VerticalDatum getVerticalDatum()  {
    return verticalDatum;
/**
 * Set information about the origin from which the
 * maximum and minimum elevation values are measured.
 */
public synchronized void setVerticalDatum(final VerticalDatum newValue ) {
    checkWritePermission();
/**
 * Set information about the origin from which the
 * maximum and minimum elevation values are measured.
 *
 * @deprecated use setVerticalCRS
 */
public synchronized void setVerticalDatum(final VerticalDatum newValue ) {
    checkWritePermission();
        final VerticalExtentImpl that = (VerticalExtentImpl) object;
        return Utilities.equals(this.unit,           that.unit          ) &&
               Utilities.equals(this.verticalDatum,  that.verticalDatum ) &&
               Double.doubleToLongBits(this.minimumValue) ==
               Double.doubleToLongBits(that.minimumValue) &&
               Double.doubleToLongBits(this.maximumValue) ==
               Double.doubleToLongBits(that.maximumValue);
    }
    return false;
}
        final VerticalExtentImpl that = (VerticalExtentImpl) object;
        return Utilities.equals(this.unit,           that.unit          ) &&
               Utilities.equals(this.verticalDatum,  that.verticalDatum ) &&
               Double.doubleToLongBits(this.minimumValue.doubleValue()) ==
               Double.doubleToLongBits(that.minimumValue.doubleValue()) &&
               Double.doubleToLongBits(this.maximumValue.doubleValue()) ==
               Double.doubleToLongBits(that.maximumValue.doubleValue());
    }
    return false;
}
    public String toString() {
        return String.valueOf(verticalDatum);
    }
}
    public String toString() {
        return String.valueOf(verticalDatum);
    }

    // TODO: provide CRS
    public CoordinateReferenceSystem getVerticalCRS() {
        return null; // can probably create from verticalData, min/max unit info
}
}