All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.geotoolkit.internal.jaxb.gmi.MI_Band Maven / Gradle / Ivy

Go to download

Implementations of metadata derived from ISO 19115. This module provides both an implementation of the metadata interfaces defined in GeoAPI, and a framework for handling those metadata through Java reflection.

There is a newer version: 3.20-geoapi-3.0
Show newest version
/*
 *    Geotoolkit.org - An Open Source Java GIS Toolkit
 *    http://www.geotoolkit.org
 *
 *    (C) 2010-2011, Open Source Geospatial Foundation (OSGeo)
 *    (C) 2010-2011, Geomatys
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 */
package org.geotoolkit.internal.jaxb.gmi;

import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.metadata.content.Band;
import org.geotoolkit.metadata.iso.content.DefaultBand;


/**
 * A wrapper for a metadata using the {@code "gmi"} namespace.
 *
 * @author Guilhem Legal (Geomatys)
 * @author Martin Desruisseaux (Geomatys)
 * @version 3.18
 *
 * @since 3.17
 * @module
 */
@XmlType(name = "MI_Band_Type")
@XmlRootElement(name = "MI_Band")
public class MI_Band extends DefaultBand {
    /**
     * For cross-version compatibility.
     */
    private static final long serialVersionUID = -7061684569453232088L;

    /**
     * Creates an initially empty metadata.
     * This is also the default constructor used by JAXB.
     */
    public MI_Band() {
    }

    /**
     * Creates a new metadata as a copy of the given one.
     * This is a shallow copy constructor.
     *
     * @param original The original metadata to copy.
     */
    public MI_Band(final Band original) {
        super(original);
    }

    /**
     * Wraps the given metadata into a Geotk implementation that can be marshalled,
     * using the {@code "gmi"} namespace if necessary.
     *
     * @param  original The original metadata provided by the user.
     * @return The metadata to marshall.
     */
    public static DefaultBand castOrCopy(final Band original) {
        if (original != null && !(original instanceof MI_Band)) {
            if (original.getBandBoundaryDefinition()   != null ||
                original.getNominalSpatialResolution() != null ||
                original.getTransferFunctionType()     != null ||
                original.getTransmittedPolarization()  != null ||
                original.getDetectedPolarization()     != null)
            {
                return new MI_Band(original);
            }
        }
        return DefaultBand.castOrCopy(original);
    }

    @Deprecated
    public static DefaultBand wrap(final Band original) {
        return castOrCopy(original);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy