001 /*
002 * GeoAPI - Java interfaces for OGC/ISO standards
003 * http://www.geoapi.org
004 *
005 * Copyright (C) 2006-2012 Open Geospatial Consortium, Inc.
006 * All Rights Reserved. http://www.opengeospatial.org/ogc/legal
007 *
008 * Permission to use, copy, and modify this software and its documentation, with
009 * or without modification, for any purpose and without fee or royalty is hereby
010 * granted, provided that you include the following on ALL copies of the software
011 * and documentation or portions thereof, including modifications, that you make:
012 *
013 * 1. The full text of this NOTICE in a location viewable to users of the
014 * redistributed or derivative work.
015 * 2. Notice of any changes or modifications to the OGC files, including the
016 * date changes were made.
017 *
018 * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
019 * NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020 * TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
021 * THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
022 * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
023 *
024 * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
025 * CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
026 *
027 * The name and trademarks of copyright holders may NOT be used in advertising or
028 * publicity pertaining to the software without specific, written prior permission.
029 * Title to copyright in this software and any associated documentation will at all
030 * times remain with copyright holders.
031 */
032 package org.opengis.feature;
033
034 import org.opengis.feature.type.GeometryDescriptor;
035 import org.opengis.feature.type.GeometryType;
036 import org.opengis.geometry.BoundingBox;
037
038 /**
039 * An attribute which has a geometric value.
040 * <p>
041 * The type of the value of the attribute is an arbitrary object and is
042 * implementation dependent. Implementations of this interface may wish to type
043 * narrow {@link Property#getValue()} to be specific about the type geometry.
044 * For instance to return explicitly a JTS geometry.
045 * </p>
046 * <p>
047 * Past a regular attribute, GeometryAttribute provides a method for obtaining
048 * the bounds of the underlying geometry, {@link #getBounds()}. The
049 * {@link #setBounds(BoundingBox)} method is used to explicitly set the bounds
050 * which can be useful in situations where the data source stores the bounds
051 * explicitly along with the geometry.
052 * </p>
053 *
054 * @author Jody Garnett, Refractions Research
055 * @author Justin Deoliveira, The Open Planning Project
056 */
057 public interface GeometryAttribute extends Attribute {
058
059 /**
060 * Override and type narrow to GeometryType.
061 */
062 GeometryType getType();
063
064 /**
065 * Override and type narrow to GeometryDescriptor.
066 * @return The geometry descriptor, may be null if this is a top-level value
067 */
068 GeometryDescriptor getDescriptor();
069
070 /**
071 * The bounds of the attribute.
072 * <p>
073 * This value should be derived unless explicitly set via
074 * {@link #setBounds(BoundingBox)}.
075 * </p>
076 * <p>
077 * In the case that the underlying geometry is <code>null</code>, this
078 * method should return an empty bounds as opposed to returning
079 * <code>null</code>.
080 * </p>
081 *
082 * @return The bounds of the underlying geometry, possibly empty.
083 */
084 BoundingBox getBounds();
085
086 /**
087 * Sets the bounds of the geometry.
088 * <p>
089 * This method should be used when the bounds is pre-computed and there is
090 * no need to derive it from scratch. This is mostly only relevant to data
091 * sources which store the bounds along with the geometry.
092 * </p>
093 * <p>
094 * Setting the bounds to <code>null</code> is allowed and will force the
095 * bounds to be derived manually on the next call to {@link #getBounds()}.
096 * </p>
097 *
098 * @param bounds
099 * The bounds of the attribute.
100 */
101 void setBounds(BoundingBox bounds);
102
103 }