001 /*
002 * GeoAPI - Java interfaces for OGC/ISO standards
003 * http://www.geoapi.org
004 *
005 * Copyright (C) 2006-2013 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.FeatureType;
035 import org.opengis.filter.identity.FeatureId;
036 import org.opengis.geometry.BoundingBox;
037
038 /**
039 * An instance of {@link FeatureType} representing a geographic feature composed of geometric
040 * and non-geometric properties.
041 * <p>
042 * Beyond being a complex attribute, a feature contains the following additional information:
043 * <ul>
044 * <li>A default geometry. To be used when drawing when nothing more
045 * specific has been provided.
046 * <li>The bounds of all the geometric attributes of the feature
047 * </ul>
048 * </p>
049 * @author Jody Garnett (Refractions Research)
050 * @author Justin Deoliveira (The Open Planning Project)
051 * @version GeoAPI 2.2
052 */
053 public interface Feature extends ComplexAttribute {
054
055 /**
056 * Override and type narrow to FeatureType.
057 * @return The feature type
058 */
059 FeatureType getType();
060
061 /**
062 * A unique identifier for the feature.
063 * <p>
064 * <code>getType().isIdentifiable()</code> must return <code>true</code>
065 * so this value must not return <code>null</code>.
066 * </p>
067 * <p>
068 * Generation of the identifier is dependent on the underlying data storage
069 * medium. Often this identifier is not persistent. Mediums such shapefiles
070 * and database tables have "keys" built in which map naturally to
071 * persistent feature identifiers. But other mediums do not have such keys
072 * and may have to generate feature identifiers "on-the-fly". This means
073 * that client code being able to depend on this value as a persistent
074 * entity is dependent on which storage medium or data source is being used.
075 * </p>
076 *
077 * @return The feature identifier, never <code>null</code>.
078 */
079 FeatureId getIdentifier();
080
081 /**
082 * The bounds of this Feature, if available.
083 * <p>
084 * This value is derived from any geometric attributes that the feature is
085 * composed of.
086 * </p>
087 * <p>
088 * In the case that the feature has no geometric attributes this method
089 * should return an empty bounds, ie, <code>bounds.isEmpty() == true</code>.
090 * This method should never return <code>null</code>.
091 * </p>
092 * <p>
093 * The coordinate reference system of the returned bounds is derived from
094 * the geometric attributes which were used to compute the bounds. In the
095 * event that the feature contains multiple geometric attributes which have
096 * different crs's, the one defined by {@link #getGeometryDescriptor()} should
097 * take precedence and the others should be reprojected accordingly.
098 * </p>
099 *
100 * @return the feature bounds, possibly empty.
101 */
102 BoundingBox getBounds();
103
104 /**
105 * The default geometric attribute of the feature.
106 * <p>
107 * This method returns <code>null</code> in the case where no such
108 * attribute exists.
109 * </p>
110 *
111 * @return The default geometry attribute, or <code>null</code>.
112 */
113 GeometryAttribute getDefaultGeometryProperty();
114
115 /**
116 * Sets the default geometric attribute of the feature.
117 * <p>
118 * This value must be an attribute which is already defined for the feature.
119 * In other words, this method can not be used to add a new attribute to the
120 * feature.
121 * </p>
122 *
123 * @param geometryAttribute
124 * The new geomtric attribute.
125 *
126 * @throws IllegalArgumentException If the specified attribute is not already
127 * an attribute of the feature.
128 */
129 void setDefaultGeometryProperty(GeometryAttribute geometryAttribute);
130 }