📄 labelcachedefault.html
字号:
<!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:35 GMT-05:00 2007 --><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><TITLE>LabelCacheDefault (Geotools 2.3.x 2.3.2 API)</TITLE><META NAME="keywords" CONTENT="org.geotools.renderer.lite.LabelCacheDefault class"><META NAME="keywords" CONTENT="MIN_GOODNESS_FIT"><META NAME="keywords" CONTENT="DEFAULT_PRIORITY"><META NAME="keywords" CONTENT="labelCache"><META NAME="keywords" CONTENT="labelCacheNonGrouped"><META NAME="keywords" CONTENT="DEFAULT_GROUP"><META NAME="keywords" CONTENT="DEFAULT_SPACEAROUND"><META NAME="keywords" CONTENT="styleFactory"><META NAME="keywords" CONTENT="stop()"><META NAME="keywords" CONTENT="start()"><META NAME="keywords" CONTENT="startLayer()"><META NAME="keywords" CONTENT="getPriority()"><META NAME="keywords" CONTENT="put()"><META NAME="keywords" CONTENT="endLayer()"><META NAME="keywords" CONTENT="orderedLabels()"><META NAME="keywords" CONTENT="end()"><META NAME="keywords" CONTENT="clipLineString()"><META NAME="keywords" CONTENT="clipPolygon()"><META NAME="keywords" CONTENT="processNodes()"><META NAME="keywords" CONTENT="removeFromHash()"><META NAME="keywords" CONTENT="getLongest()"><META NAME="keywords" CONTENT="putInNodeHash()"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="LabelCacheDefault (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/LabelCacheDefault.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/renderer/lite/InternalTranscoder.html" title="class in org.geotools.renderer.lite"><B>PREV CLASS</B></A> <A HREF="../../../../org/geotools/renderer/lite/LabelCacheItem.html" title="class in org.geotools.renderer.lite"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="LabelCacheDefault.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 | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <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.renderer.lite</FONT><BR>Class LabelCacheDefault</H2><PRE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by"><B>LabelCacheDefault</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../org/geotools/renderer/lite/LabelCache.html" title="interface in org.geotools.renderer.lite">LabelCache</A></DD></DL><HR><DL><DT>public final class <B>LabelCacheDefault</B><DT>extends <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A><DT>implements <A HREF="../../../../org/geotools/renderer/lite/LabelCache.html" title="interface in org.geotools.renderer.lite">LabelCache</A></DL><P>Default LabelCache Implementation DJB (major changes on May 11th, 2005): 1.The old version of the labeler, if given a *set* of points, lines, or polygons justed labels the first item in the set. The sets are formed when you want to only put a single "Main St" on the map even if you have a bunch of small "Main St" segments. I changed this to be much much wiser. Basically, the new way looks at the set of geometries that its going to put a label on and find the "best" one that represents it. That geometry is then labeled (see below for details on where that label is placed). 2. I changed the actual drawing routines; 1. get the "representative geometry" 2. for points, label as before 3. for lines, find the middle point on the line (old version just averaged start and end points) and centre label on that point (rotated) 4. for polygon, put the label in the middle 3. ie. for lines, try the label at the 1/3, 1/2, and 2/3 location. Metric is how close the label bounding box is to the line. ie. for polygons, bisect the polygon (about the centroid) in to North, South, East and West polygons. Use the location that has the label best inside the polygon. After this is done, you can start doing constraint relaxation... 4. TODO: deal with labels going off the edge of the screen (much reduced now). 5. TODO: add a "minimum quality" parameter (ie. if you're labeling a tiny polygon with a tiny label, dont bother). Metrics are descibed in #3. 6. TODO: add ability for SLD to tweak parameters (ie. "always label"). ------------------------------------------------------------------------------------------ I've added extra functionality; a) priority -- if you set the <Priority> in a TextSymbolizer, then you can control the order of labelling ** see mailing list for more details b) <VendorOption name="group">no</VendorOption> --- turns off grouping for this symbolizer c) <VendorOption name="spaceAround">5</VendorOption> -- do not put labels within 5 pixels of this label.<P><P><DL><DT><B>Author:</B></DT> <DD>jeichar, dblasby</DD><DT><B>Module:</B></DT><DD><CODE><B>module/render</B></CODE> (<A HREF="http://maven.geotools.fr/repository/org/geotools/gt2-render/"><CODE>gt2-render.jar</CODE></A>) (<A HREF="http://maven.geotools.fr/reports/render/index.html">Maven report</A>) (<A HREF="http://svn.geotools.org/geotools/tags/2.3.2/module/render/src/org/geotools/renderer/lite/LabelCacheDefault.java">SVN head</A>)</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/geotools/renderer/lite/LabelCacheDefault.html#DEFAULT_GROUP">DEFAULT_GROUP</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/geotools/renderer/lite/LabelCacheDefault.html#DEFAULT_PRIORITY">DEFAULT_PRIORITY</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/geotools/renderer/lite/LabelCacheDefault.html#DEFAULT_SPACEAROUND">DEFAULT_SPACEAROUND</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/geotools/renderer/lite/LabelCacheDefault.html#labelCache">labelCache</A></B></CODE><BR> Map<label, LabelCacheItem> the label cache</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/ArrayList.html" title="class or interface in java.util">ArrayList</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/geotools/renderer/lite/LabelCacheDefault.html#labelCacheNonGrouped">labelCacheNonGrouped</A></B></CODE><BR> non-grouped labels get thrown in here*</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/geotools/renderer/lite/LabelCacheDefault.html#MIN_GOODNESS_FIT">MIN_GOODNESS_FIT</A></B></CODE><BR> labels that arent this good will not be shown</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../../../org/geotools/renderer/style/SLDStyleFactory.html" title="class in org.geotools.renderer.style">SLDStyleFactory</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/geotools/renderer/lite/LabelCacheDefault.html#styleFactory">styleFactory</A></B></CODE><BR> </TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../../org/geotools/renderer/lite/LabelCacheDefault.html#LabelCacheDefault()">LabelCacheDefault</A></B>()</CODE><BR> </TD></TR></TABLE> <!-- ========== 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://www.jump-project.org/docs/jts/1.7/api/com/vividsolutions/jts/geom/MultiLineString.html" title="class or interface in com.vividsolutions.jts.geom">MultiLineString</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/geotools/renderer/lite/LabelCacheDefault.html#clipLineString(com.vividsolutions.jts.geom.LineString, com.vividsolutions.jts.geom.Polygon, com.vividsolutions.jts.geom.Envelope)">clipLineString</A></B>(<A HREF="http://www.jump-project.org/docs/jts/1.7/api/com/vividsolutions/jts/geom/LineString.html" title="class or interface in com.vividsolutions.jts.geom">LineString</A> line, <A HREF="http://www.jump-project.org/docs/jts/1.7/api/com/vividsolutions/jts/geom/Polygon.html" title="class or interface in com.vividsolutions.jts.geom">Polygon</A> bbox, <A HREF="http://www.jump-project.org/docs/jts/1.7/api/com/vividsolutions/jts/geom/Envelope.html" title="class or interface in com.vividsolutions.jts.geom">Envelope</A> displayGeomEnv)</CODE><BR> try to be more robust dont bother returning points This will try to solve robustness problems, but read code as to what it does. </TD></TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -