001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016:
017: /*
018: * Geotools - OpenSource mapping toolkit
019: * (C) 2002, Centre for Computational Geography
020: *
021: * This library is free software; you can redistribute it and/or
022: * modify it under the terms of the GNU Lesser General Public
023: * License as published by the Free Software Foundation;
024: * version 2.1 of the License.
025: *
026: * This library is distributed in the hope that it will be useful,
027: * but WITHOUT ANY WARRANTY; without even the implied warranty of
028: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
029: * Lesser General Public License for more details.
030: *
031: * You should have received a copy of the GNU Lesser General Public
032: * License along with this library; if not, write to the Free Software
033: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
034: *
035: *
036: * Contacts:
037: * UNITED KINGDOM: James Macgill. j.macgill@geog.leeds.ac.uk
038: */
039: package org.geotools.styling;
040:
041: import java.util.Map;
042: import org.opengis.filter.expression.Expression;
043:
044: /**
045: * A symbolizer describes how a feature should appear on a map.
046: *
047: * <p>
048: * A symbolizer is obtained by specifying one of a small number of different
049: * types of symbolizer and then supplying parameters to override its default
050: * behaviour.
051: * </p>
052: *
053: * <p>
054: * The text symbolizer describes how to display text labels and the like.
055: * </p>
056: *
057: * <p>
058: * The details of this object are taken from the <a
059: * href="https://portal.opengeospatial.org/files/?artifact_id=1188"> OGC
060: * Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.</a>:
061: * <pre><code>
062: * <xsd:element name="TextSymbolizer" substitutionGroup="sld:Symbolizer">
063: * <xsd:annotation>
064: * <xsd:documentation>
065: * A "TextSymbolizer" is used to render text labels according to
066: * various graphical parameters.
067: * </xsd:documentation>
068: * </xsd:annotation>
069: * <xsd:complexType>
070: * <xsd:complexContent>
071: * <xsd:extension base="sld:SymbolizerType">
072: * <xsd:sequence>
073: * <xsd:element ref="sld:Geometry" minOccurs="0"/>
074: * <xsd:element ref="sld:Label" minOccurs="0"/>
075: * <xsd:element ref="sld:Font" minOccurs="0"/>
076: * <xsd:element ref="sld:LabelPlacement" minOccurs="0"/>
077: * <xsd:element ref="sld:Halo" minOccurs="0"/>
078: * <xsd:element ref="sld:Fill" minOccurs="0"/>
079: * </xsd:sequence>
080: * </xsd:extension>
081: * </xsd:complexContent>
082: * </xsd:complexType>
083: * </xsd:element>
084: * </code></pre>
085: * </p>
086: *
087: * <p>
088: * Renderers can use this information when displaying styled features, though
089: * it must be remembered that not all renderers will be able to fully
090: * represent strokes as set out by this interface. For example, opacity may
091: * not be supported.
092: * </p>
093: *
094: * <p>
095: * Notes:
096: *
097: * <ul>
098: * <li>
099: * The graphical parameters and their values are derived from SVG/CSS2
100: * standards with names and semantics which are as close as possible.
101: * </li>
102: * </ul>
103: * </p>
104: * $Id: TextSymbolizer.java 25459 2007-05-08 05:19:25Z jgarnett $
105: *
106: * @author Ian Turton, CCG
107: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/api/src/main/java/org/geotools/styling/TextSymbolizer.java $
108: */
109: public interface TextSymbolizer extends Symbolizer {
110: /**
111: * Returns the expression that will be evaluated to determine what text is
112: * displayed.
113: *
114: * @return DOCUMENT ME!
115: */
116: Expression getLabel();
117:
118: /**
119: * Sets the expression that will be evaluated to determine what text is
120: * displayed. See {@link #getLabel} for details.
121: *
122: * @param label DOCUMENT ME!
123: */
124: void setLabel(Expression label);
125:
126: /**
127: * Returns a device independent Font object that is to be used to render
128: * the label.
129: *
130: * @return DOCUMENT ME!
131: */
132: Font[] getFonts();
133:
134: /**
135: * sets a list of device independent Font objects to be used to render the
136: * label.
137: *
138: * @param fonts DOCUMENT ME!
139: */
140: void setFonts(Font[] fonts);
141:
142: /**
143: * A LabelPlacement specifies how a text element should be rendered
144: * relative to its geometric point or line.
145: *
146: * @return DOCUMENT ME!
147: *
148: * @since Geotools 2.2 (GeoAPI 2.0)
149: */
150: LabelPlacement getPlacement();
151:
152: /**
153: * A LabelPlacement specifies how a text element should be rendered
154: * relative to its geometric point or line.
155: *
156: * @return DOCUMENT ME!
157: *
158: * @deprecated use getPlacement()
159: */
160: LabelPlacement getLabelPlacement();
161:
162: /**
163: * A LabelPlacement specifies how a text element should be rendered
164: * relative to its geometric point or line.
165: *
166: * @param labelPlacement DOCUMENT ME!
167: *
168: * @deprecated use setPlacement(LabelPlacement)
169: */
170: void setLabelPlacement(LabelPlacement labelPlacement);
171:
172: /**
173: * A LabelPlacement specifies how a text element should be rendered
174: * relative to its geometric point or line.
175: *
176: * @param labelPlacement DOCUMENT ME!
177: */
178: void setPlacement(LabelPlacement labelPlacement);
179:
180: /**
181: * A halo fills an extended area outside the glyphs of a rendered text
182: * label to make the label easier to read over a background.
183: *
184: * @return DOCUMENT ME!
185: */
186: Halo getHalo();
187:
188: /**
189: * A halo fills an extended area outside the glyphs of a rendered text
190: * label to make the label easier to read over a background.
191: *
192: * @param halo DOCUMENT ME!
193: */
194: void setHalo(Halo halo);
195:
196: /**
197: * Returns the object that indicates how the text will be filled.
198: *
199: * @return DOCUMENT ME!
200: */
201: Fill getFill();
202:
203: /**
204: * Sets the object that indicates how the text will be filled. See {@link
205: * #getFill} for details.
206: *
207: * @param fill DOCUMENT ME!
208: */
209: void setFill(Fill fill);
210:
211: /**
212: * This property defines the geometry to be used for styling.<br>
213: * The property is optional and if it is absent (null) then the "default"
214: * geometry property of the feature should be used. Geometry types other
215: * than inherently point types can be used. The geometryPropertyName is
216: * the name of a geometry property in the Feature being styled.
217: * Typically, features only have one geometry so, in general, the need to
218: * select one is not required. Note: this moves a little away from the SLD
219: * spec which provides an XPath reference to a Geometry object, but does
220: * follow it in spirit.
221: *
222: * @return The name of the attribute in the feature being styled that
223: * should be used. If null then the default geometry should be
224: * used.
225: */
226: String getGeometryPropertyName();
227:
228: /**
229: * This property defines the geometry to be used for styling.<br>
230: * The property is optional and if it is absent (null) then the "default"
231: * geometry property of the feature should be used. Geometry types other
232: * than inherently point types can be used. The geometryPropertyName is
233: * the name of a geometry property in the Feature being styled.
234: * Typically, features only have one geometry so, in general, the need to
235: * select one is not required. Note: this moves a little away from the SLD
236: * spec which provides an XPath reference to a Geometry object, but does
237: * follow it in spirit.
238: *
239: * @param name The name of the attribute in the feature being styled that
240: * should be used. If null then the default geometry should be
241: * used.
242: */
243: void setGeometryPropertyName(String name);
244:
245: /**
246: * Priority -- null = use the default labeling priority Expression =
247: * an expression that evaluates to a number (ie. Integer, Long, Double...)
248: * Larger = more likely to be rendered
249: *
250: * @param e
251: */
252: void setPriority(Expression e);
253:
254: /**
255: * Priority -- null = use the default labeling priority Expression =
256: * an expression that evaluates to a number (ie. Integer, Long, Double...)
257: * Larger = more likely to be rendered
258: *
259: * @return DOCUMENT ME!
260: */
261: Expression getPriority();
262:
263: /**
264: * adds a parameter value to the options map
265: *
266: * @param key
267: * @param value
268: */
269: void addToOptions(String key, String value);
270:
271: /**
272: * Find the value of a key in the map (may return null)
273: *
274: * @param key
275: *
276: */
277: String getOption(String key);
278:
279: /**
280: * return the map of option
281: *
282: * @return null - no options set
283: */
284: Map getOptions();
285: }
|