001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/model/feature/Feature.java $ 002 /*---------------- FILE HEADER ------------------------------------------ 003 004 This file is part of deegree. 005 Copyright (C) 2001-2008 by: 006 EXSE, Department of Geography, University of Bonn 007 http://www.giub.uni-bonn.de/deegree/ 008 lat/lon GmbH 009 http://www.lat-lon.de 010 011 This library is free software; you can redistribute it and/or 012 modify it under the terms of the GNU Lesser General Public 013 License as published by the Free Software Foundation; either 014 version 2.1 of the License, or (at your option) any later version. 015 016 This library is distributed in the hope that it will be useful, 017 but WITHOUT ANY WARRANTY; without even the implied warranty of 018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 019 Lesser General Public License for more details. 020 021 You should have received a copy of the GNU Lesser General Public 022 License along with this library; if not, write to the Free Software 023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 024 025 Contact: 026 027 Andreas Poth 028 lat/lon GmbH 029 Aennchenstraße 19 030 53177 Bonn 031 Germany 032 E-Mail: poth@lat-lon.de 033 034 Prof. Dr. Klaus Greve 035 Department of Geography 036 University of Bonn 037 Meckenheimer Allee 166 038 53115 Bonn 039 Germany 040 E-Mail: greve@giub.uni-bonn.de 041 042 ---------------------------------------------------------------------------*/ 043 044 package org.deegree.model.feature; 045 046 import java.util.Map; 047 048 import org.deegree.datatypes.QualifiedName; 049 import org.deegree.io.datastore.PropertyPathResolvingException; 050 import org.deegree.model.feature.schema.FeatureType; 051 import org.deegree.model.spatialschema.Envelope; 052 import org.deegree.model.spatialschema.Geometry; 053 import org.deegree.model.spatialschema.GeometryException; 054 import org.deegree.ogcbase.PropertyPath; 055 056 /** 057 * Features are, according to the Abstract Specification, digital representations of real world 058 * entities. Feature Identity thus refers to mechanisms to identify such representations: not to 059 * identify the real world entities that are the subject of a representation. Thus two different 060 * representations of a real world entity (say the Mississippi River) will be two different features 061 * with distinct identities. Real world identification systems, such as title numbers, while 062 * possibly forming a sound basis for an implementation of a feature identity mechanism, are not of 063 * themselves such a mechanism. 064 * 065 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a> 066 * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider</a> 067 * @version $Revision: 9343 $ $Date: 2007-12-27 14:30:32 +0100 (Do, 27 Dez 2007) $ 068 */ 069 public interface Feature { 070 071 /** 072 * Returns the qualified name of the feature. 073 * 074 * @return the qualified name of the feature 075 */ 076 QualifiedName getName(); 077 078 /** 079 * Returns the description of the feature. 080 * 081 * @return the description of the feature. 082 */ 083 String getDescription(); 084 085 /** 086 * Returns the id of the feature. 087 * 088 * @return the id of the feature 089 */ 090 String getId(); 091 092 /** 093 * Sets the id of the feature. 094 * 095 * @param fid 096 * the id of the feature to be set 097 */ 098 void setId( String fid ); 099 100 /** 101 * Returns the feature type of this feature. 102 * 103 * @return the feature type of this feature 104 */ 105 FeatureType getFeatureType(); 106 107 /** 108 * Sets the feature type of this feature. 109 * 110 * @param ft 111 * feature type to set 112 */ 113 void setFeatureType( FeatureType ft ); 114 115 /** 116 * Returns all properties of the feature in their original order. 117 * 118 * @return all properties of the feature 119 */ 120 FeatureProperty[] getProperties(); 121 122 /** 123 * Returns the first property of the feature with the given name. 124 * 125 * @param name 126 * name of the property to look up 127 * @return the first property of the feature with the given name or null if the feature has no 128 * such property 129 */ 130 FeatureProperty getDefaultProperty( QualifiedName name ); 131 132 /** 133 * Returns the property of the feature identified by the given {@link PropertyPath}. 134 * 135 * NOTE: Current implementation does not handle multiple properties (on the path) or index 136 * addressing in the path. 137 * 138 * @param path 139 * the path of the property to look up 140 * @return the property of the feature identified by the given PropertyPath 141 * @throws PropertyPathResolvingException 142 * 143 * @see PropertyPath 144 */ 145 FeatureProperty getDefaultProperty( PropertyPath path ) 146 throws PropertyPathResolvingException; 147 148 /** 149 * Returns the properties of the feature with the given name in their original order. 150 * 151 * @param name 152 * name of the properties to look up 153 * @return the properties of the feature with the given name or null if the feature has no 154 * property with that name 155 */ 156 FeatureProperty[] getProperties( QualifiedName name ); 157 158 /** 159 * Returns the properties of the feature at the submitted index of the feature type definition. 160 * 161 * @param index 162 * index of the properties to look up 163 * @return the properties of the feature at the submitted index 164 * @deprecated 165 */ 166 @Deprecated 167 FeatureProperty[] getProperties( int index ); 168 169 /** 170 * Returns the values of all geometry properties of the feature. 171 * 172 * @return the values of all geometry properties of the feature, or a zero-length array if the 173 * feature has no geometry properties 174 */ 175 Geometry[] getGeometryPropertyValues(); 176 177 /** 178 * Returns the value of the default geometry property of the feature. If the feature has no 179 * geometry property, this is a Point at the coordinates (0,0). 180 * 181 * @return default geometry or Point at (0,0) if feature has no geometry 182 */ 183 Geometry getDefaultGeometryPropertyValue(); 184 185 /** 186 * Sets the value for the given property. The index is needed to specify the occurences of the 187 * property that is to be replaced. Set to 0 for properties that may only occur once. 188 * 189 * @param property 190 * property name and the property's new value 191 * @param index 192 * position of the property that is to be replaced 193 */ 194 void setProperty( FeatureProperty property, int index ); 195 196 /** 197 * Adds the given property to the feature's properties. The position of the property is 198 * determined by the feature type. If the feature already has a property with this name, it is 199 * inserted behind it. 200 * 201 * @param property 202 * property to insert 203 */ 204 void addProperty( FeatureProperty property ); 205 206 /** 207 * Removes the properties with the given name. 208 * 209 * @param propertyName 210 * name of the properties to remove 211 */ 212 void removeProperty( QualifiedName propertyName ); 213 214 /** 215 * Replaces the given property with a new one. 216 * 217 * @param oldProperty 218 * property to be replaced 219 * @param newProperty 220 * new property 221 */ 222 void replaceProperty( FeatureProperty oldProperty, FeatureProperty newProperty ); 223 224 /** 225 * Returns the envelope / bounding box of the feature. 226 * 227 * @return the envelope / bounding box of the feature 228 * @throws GeometryException 229 */ 230 Envelope getBoundedBy() 231 throws GeometryException; 232 233 /** 234 * Returns the owner of the feature. This is the feature property that has this feature as value 235 * or null if this feature is a root feature. 236 * 237 * @return the owner of the feature, or null if the feature does not belong to a feature 238 * property 239 */ 240 FeatureProperty getOwner(); 241 242 /** 243 * Returns the attribute value of the attribute with the specified name. 244 * 245 * @param name 246 * name of the attribute 247 * @return the attribute value 248 */ 249 String getAttribute( String name ); 250 251 /** 252 * Returns all attributes of the feature. 253 * 254 * @return all attributes, keys are names, values are attribute values 255 */ 256 Map<String, String> getAttributes(); 257 258 /** 259 * Sets the value of the attribute with the given name. 260 * 261 * @param name 262 * name of the attribute 263 * @param value 264 * value to set 265 */ 266 void setAttribute( String name, String value ); 267 268 /** 269 * Signals that the envelopes of the geometry properties have been updated. 270 */ 271 public void setEnvelopesUpdated(); 272 273 }