Source Code Cross Referenced for TextSymbolizer.java in  » GIS » deegree » org » deegree » graphics » sld » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » deegree » org.deegree.graphics.sld 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/graphics/sld/TextSymbolizer.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:         Aennchenstr. 19
030:         53115 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.graphics.sld;
045:
046:        import org.deegree.framework.xml.Marshallable;
047:
048:        /**
049:         * Used to render a text label, according to the parameters. A missing Geometry, Label, Font, or
050:         * LabelPlacement element selects the default value or behavior for the element. The default Label,
051:         * Font, and LabelPlacement are system- dependent. Multiple Font elements may be used to specify
052:         * alternate fonts in order of preference in case a map server does not support the first
053:         * preference. A missing Halo or Fill element means that no halo or fill will be plotted,
054:         * respectively. The Fill is rendered over top of the Halo, and the Halo includes the interiors of
055:         * the font glyphs.
056:         * <p>
057:         * 
058:         * @author <a href="mailto:k.lupp@web.de">Katharina Lupp</a>
059:         * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider</a>
060:         * @version $Revision: 10615 $ $Date: 2008-03-18 05:42:49 -0700 (Tue, 18 Mar 2008) $
061:         */
062:
063:        public class TextSymbolizer extends AbstractSymbolizer implements 
064:                Marshallable {
065:
066:            private Fill fill = null;
067:
068:            private Font font = null;
069:
070:            private Halo halo = null;
071:
072:            private LabelPlacement labelPlacement = null;
073:
074:            private ParameterValueType label = null;
075:
076:            private ParameterValueType[] bbox;
077:
078:            /**
079:             * constructor initializing the class with the <code>TextSymbolizer</code>
080:             */
081:            TextSymbolizer(Geometry geometry, ParameterValueType label,
082:                    Font font, LabelPlacement labelPlacement, Halo halo,
083:                    Fill fill, double min, double max) {
084:                super (geometry,
085:                        "org.deegree.graphics.displayelements.LabelDisplayElement");
086:                setLabel(label);
087:                setFont(font);
088:                setLabelPlacement(labelPlacement);
089:                setHalo(halo);
090:                setFill(fill);
091:                setMinScaleDenominator(min);
092:                setMaxScaleDenominator(max);
093:            }
094:
095:            /**
096:             * constructor initializing the class with the <code>TextSymbolizer</code>
097:             */
098:            TextSymbolizer(Geometry geometry, String responsibleClass,
099:                    ParameterValueType label, Font font,
100:                    LabelPlacement labelPlacement, Halo halo, Fill fill,
101:                    double min, double max) {
102:                super (geometry, responsibleClass);
103:                setLabel(label);
104:                setFont(font);
105:                setLabelPlacement(labelPlacement);
106:                setHalo(halo);
107:                setFill(fill);
108:                setMinScaleDenominator(min);
109:                setMaxScaleDenominator(max);
110:            }
111:
112:            /**
113:             * Initializing with bounding box.
114:             * 
115:             * @param geometry
116:             * @param text
117:             * @param font
118:             * @param halo
119:             * @param minx
120:             * @param miny
121:             * @param maxx
122:             * @param maxy
123:             */
124:            public TextSymbolizer(Geometry geometry, ParameterValueType text,
125:                    Font font, Halo halo, ParameterValueType minx,
126:                    ParameterValueType miny, ParameterValueType maxx,
127:                    ParameterValueType maxy) {
128:                super (geometry,
129:                        "org.deegree.graphics.displayelements.LabelDisplayElement");
130:                setLabel(text);
131:                setFont(font);
132:                setHalo(halo);
133:                bbox = new ParameterValueType[] { minx, miny, maxx, maxy };
134:                setLabelPlacement(new LabelPlacement((LinePlacement) null));
135:            }
136:
137:            /**
138:             * @return the bounding box, or null, if not set (minx, miny, maxx, maxy)
139:             */
140:            public ParameterValueType[] getBoundingBox() {
141:                return bbox;
142:            }
143:
144:            /**
145:             * returns the Label as a <tt>ParameterValueType</tt> to be renderd
146:             * 
147:             * @return the label
148:             * 
149:             */
150:            public ParameterValueType getLabel() {
151:                return label;
152:            }
153:
154:            /**
155:             * sets the <Label>
156:             * 
157:             * @param label
158:             *            the label
159:             * 
160:             */
161:            public void setLabel(ParameterValueType label) {
162:                this .label = label;
163:            }
164:
165:            /**
166:             * Identifies a Font of a certain family, style, and size.
167:             * 
168:             * @return the font
169:             * 
170:             */
171:            public Font getFont() {
172:                return font;
173:            }
174:
175:            /**
176:             * Sets a Font of a certain family, style, and size.
177:             * 
178:             * @param font
179:             *            the font
180:             * 
181:             */
182:            public void setFont(Font font) {
183:                this .font = font;
184:            }
185:
186:            /**
187:             * Used to position a label relative to a point or a line string. For a point, you can specify
188:             * the anchor point of the label and a linear displacement from the point (so that you can also
189:             * plot a graphic symbol at the point). For a line-string placement, you can specify a
190:             * perpendicular offset (so you can draw a stroke on the line).
191:             * <p>
192:             * </p>
193:             * MORE PARAMETERS ARE PROBABLY NEEDED HERE.
194:             * 
195:             * @return the labelPlacement
196:             * 
197:             */
198:            public LabelPlacement getLabelPlacement() {
199:                return labelPlacement;
200:            }
201:
202:            /**
203:             * sets the <LabelPlacement>
204:             * 
205:             * @param labelPlacement
206:             *            the labelPlacement
207:             * 
208:             */
209:            public void setLabelPlacement(LabelPlacement labelPlacement) {
210:                this .labelPlacement = labelPlacement;
211:            }
212:
213:            /**
214:             * A Halo is an extension (sub-type) of a Fill and is applied to the backgrounds of font glyphs.
215:             * Either a Radius or a Block halo type can be used. The radius is computed from the outside
216:             * edge of the font glyph (or inside of "holes"). The default is a Radius of 1.0 (pixels) but if
217:             * no Halo is selected in a containing structure, no halo will be rendered. The default is a
218:             * solid white (Color "#FFFFFF") opaque halo.
219:             * 
220:             * @return the halo
221:             * 
222:             */
223:            public Halo getHalo() {
224:                return halo;
225:            }
226:
227:            /**
228:             * sets <Halo>
229:             * 
230:             * @param halo
231:             *            the halo
232:             * 
233:             */
234:            public void setHalo(Halo halo) {
235:                this .halo = halo;
236:            }
237:
238:            /**
239:             * A Fill allows area geometries to be filled. There are two types of fills: solid-color and
240:             * repeated GraphicFill. In general, if a Fill element is omitted in its containing element, no
241:             * fill will be rendered. The default is a solid 50%-gray (color "#808080") opaque fill.
242:             * 
243:             * @return the fill
244:             * 
245:             */
246:            public Fill getFill() {
247:                return fill;
248:            }
249:
250:            /**
251:             * sets the <Fill>
252:             * 
253:             * @param fill
254:             *            the fill
255:             * 
256:             */
257:            public void setFill(Fill fill) {
258:                this .fill = fill;
259:            }
260:
261:            /**
262:             * exports the content of the TextSymbolizer as XML formated String
263:             * 
264:             * @return xml representation of the TextSymbolizer
265:             */
266:            public String exportAsXML() {
267:
268:                StringBuffer sb = new StringBuffer(1000);
269:                sb.append("<TextSymbolizer>");
270:                if (geometry != null) {
271:                    sb.append(((Marshallable) geometry).exportAsXML());
272:                }
273:                if (label != null) {
274:                    sb.append("<Label>");
275:                    sb.append(((Marshallable) label).exportAsXML());
276:                    sb.append("</Label>");
277:                }
278:                if (font != null) {
279:                    sb.append(((Marshallable) font).exportAsXML());
280:                }
281:                if (labelPlacement != null) {
282:                    sb.append(((Marshallable) labelPlacement).exportAsXML());
283:                }
284:                if (halo != null) {
285:                    sb.append(((Marshallable) halo).exportAsXML());
286:                }
287:                if (fill != null) {
288:                    sb.append(((Marshallable) fill).exportAsXML());
289:                }
290:                sb.append("</TextSymbolizer>");
291:
292:                return sb.toString();
293:            }
294:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.