simplefeature.html
来自「Geotools是一个开源的Java GIS工具包,可利用它来开发符合标准的地理」· HTML 代码 · 共 453 行 · 第 1/2 页
HTML
453 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.4.2_13) on Tue Jun 05 11:36:24 GMT-05:00 2007 --><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><TITLE>SimpleFeature (Geotools 2.3.x 2.3.2 API)</TITLE><META NAME="keywords" CONTENT="org.geotools.feature.SimpleFeature interface"><META NAME="keywords" CONTENT="getFeatureType()"><META NAME="keywords" CONTENT="setAttributes()"><META NAME="keywords" CONTENT="getAttribute()"><META NAME="keywords" CONTENT="setAttribute()"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="SimpleFeature (Geotools 2.3.x 2.3.2 API)";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SimpleFeature.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../org/geotools/feature/PrimativeAttributeType.html" title="interface in org.geotools.feature"><B>PREV CLASS</B></A> NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="SimpleFeature.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">org.geotools.feature</FONT><BR>Interface SimpleFeature</H2><DL><DT><B>All Superinterfaces:</B> <DD><A HREF="../../../org/geotools/feature/Feature.html" title="interface in org.geotools.feature">Feature</A></DD></DL><DL><DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../org/geotools/feature/DefaultFeature.html" title="class in org.geotools.feature">DefaultFeature</A></DD></DL><HR><DL><DT>public interface <B>SimpleFeature</B><DT>extends <A HREF="../../../org/geotools/feature/Feature.html" title="interface in org.geotools.feature">Feature</A></DL><P>A simple feature is one that does not have any nested attributes, and that has no multiplicity for each attribute. In non xml speak this means that the attributes returned are guaranteed to be the Objects you would expect - not Lists as is the case when Features are non-simple. This is thus a constraining extension - it essentially allows you to make a few more assumptions about the nature of the <A HREF="../../../org/geotools/feature/Feature.html" title="interface in org.geotools.feature"><CODE>Feature</CODE></A> you are getting back. <p> The notion of a Simple Feature is drawn from the OGC's Simple Features for SQL specification - where a simple feature represents a single row in a database table. This extends beyond databases though, to flat files, for example. A database does not necessarily only return simple features - indeed by relying on foreign keys much more complex structures can be created. But at the time of the creation of this class all GeoTools datastores return Simple Features - they just were not explicitly called that. Making explicit that they are Simple should hopefully encourage more complex Features to be returned. </p> <p> The assumptions one can make with Simple Features are as follows: </p> <ul> <li> If <A HREF="../../../org/geotools/feature/SimpleFeature.html#getAttribute(int)"><CODE>getAttribute(int)</CODE></A> is called then it will always return an actual object, instead of a List, as is common in the parent Feature class. That is to say a Simple Feature will never have more than one attribute in any of its positions, so the interface just assumes that you want the actual object, instead of a List containing just the object. </li> <li> If <A HREF="../../../org/geotools/feature/SimpleFeature.html#setAttribute(int, java.lang.Object)"><CODE>setAttribute(int, Object)</CODE></A> is called then a similar assumption is made about the object being set - it need be a List, will default to setting the attribute itself. </li> <li> <A HREF="../../../org/geotools/feature/SimpleFeature.html#getAttribute(java.lang.String)"><CODE>getAttribute(String)</CODE></A> and <A HREF="../../../org/geotools/feature/Feature.html#setAttribute(java.lang.String, java.lang.Object)"><CODE>Feature.setAttribute(String, Object)</CODE></A> implicitly append a [0], as that's the behavior implementors expect - to name an attribute and get it back. </li> </ul> <p> To figure out if a Feature is a SimpleFeature one may call instanceof. For a number of Features returned from a DataStore it will save much energy if instanceof is called on the FeatureType, to check if it is a <A HREF="../../../org/geotools/feature/SimpleFeatureType.html" title="class in org.geotools.feature"><CODE>SimpleFeatureType</CODE></A>. And in the future we should have FeatureCollections that know their types. </p><P><P><DL><DT><B>Since:</B></DT> <DD>2.1</DD><DT><B>Author:</B></DT> <DD>David Zwiers, Refractions, Chris Holmes, TOPP</DD><DT><B>Module:</B></DT><DD><CODE><B>module/main</B></CODE> (<A HREF="http://maven.geotools.fr/repository/org/geotools/gt2-main/"><CODE>gt2-main.jar</CODE></A>) (<A HREF="http://maven.geotools.fr/reports/main/index.html">Maven report</A>) (<A HREF="http://svn.geotools.org/geotools/tags/2.3.2/module/main/src/org/geotools/feature/SimpleFeature.java">SVN head</A>)</DD><DT><B>'TODO:'</B></DT> <DD>REVISIT: I am not sure that I like getAttribute returning the object straight away. It might be better to have a getFirstAttribute() method in Feature.java, and move people to get used to calling that, or else to expect a List (which in a SimpleFeature would always only contain one Object). This would seem to make the api a bit cleaner in my mind.</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><A NAME="nested_class_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Nested Class Summary</B></FONT></TD></TR></TABLE> <A NAME="nested_classes_inherited_from_class_org.geotools.feature.Feature"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Nested classes inherited from class <A HREF="../../../org/geotools/feature/Feature.html" title="interface in org.geotools.feature">Feature</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../org/geotools/feature/Feature.NULL.html" title="class in org.geotools.feature">Feature.NULL</A></CODE></TD></TR></TABLE> <!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/feature/SimpleFeature.html#getAttribute(int)">getAttribute</A></B>(int index)</CODE><BR> Gets an attribute by the given zero-based index. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/feature/SimpleFeature.html#getAttribute(java.lang.String)">getAttribute</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> xPath)</CODE><BR> This is the same as the parent declaration, except that when the instance is not specified for the xPath, [0] will be added as there is only ever one Attribute value for an AttributeType</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?