Source Code Cross Referenced for SLDMockData.java in  » GIS » GeoTools-2.4.1 » org » geotools » sld » bindings » 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 » GeoTools 2.4.1 » org.geotools.sld.bindings 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:        package org.geotools.sld.bindings;
017:
018:        import org.w3c.dom.Document;
019:        import org.w3c.dom.Element;
020:        import org.w3c.dom.Node;
021:        import javax.xml.namespace.QName;
022:        import org.geotools.filter.v1_0.OGC;
023:
024:        public class SLDMockData {
025:            static Element anchorPoint(Document document, Node parent) {
026:                Element anchorPoint = element(SLD.ANCHORPOINT, document, parent);
027:
028:                Element x = element(SLD.ANCHORPOINTX, document, anchorPoint);
029:                x.appendChild(document.createTextNode("1"));
030:
031:                Element y = element(SLD.ANCHORPOINTY, document, anchorPoint);
032:                y.appendChild(document.createTextNode("2"));
033:
034:                return anchorPoint;
035:            }
036:
037:            static Element displacement(Document document, Node parent) {
038:                Element displacement = element(SLD.DISPLACEMENT, document,
039:                        parent);
040:
041:                Element x = element(SLD.DISPLACEMENTX, document, displacement);
042:                x.appendChild(document.createTextNode("1"));
043:
044:                Element y = element(SLD.DISPLACEMENTY, document, displacement);
045:                y.appendChild(document.createTextNode("2"));
046:
047:                return displacement;
048:            }
049:
050:            static Element size(Document document, Node parent) {
051:                Element size = element(SLD.SIZE, document, parent);
052:                size.appendChild(document.createTextNode("1"));
053:
054:                return size;
055:            }
056:
057:            static Element opacity(Document document, Node parent) {
058:                Element opacity = element(SLD.OPACITY, document, parent);
059:                opacity.appendChild(document.createTextNode("1"));
060:
061:                return opacity;
062:            }
063:
064:            static Element rotation(Document document, Node parent) {
065:                Element rotation = element(SLD.ROTATION, document, parent);
066:                rotation.appendChild(document.createTextNode("90"));
067:
068:                return rotation;
069:            }
070:
071:            static Element pointPlacement(Document document, Node parent) {
072:                Element pointPlacement = element(SLD.POINTPLACEMENT, document,
073:                        parent);
074:                anchorPoint(document, pointPlacement);
075:                displacement(document, pointPlacement);
076:                rotation(document, pointPlacement);
077:
078:                return pointPlacement;
079:            }
080:
081:            static Element css(String name, String value, Document document,
082:                    Node parent) {
083:                Element css = element(SLD.CSSPARAMETER, document, parent);
084:                css.setAttribute("name", name);
085:                css.appendChild(document.createTextNode(value));
086:
087:                return css;
088:            }
089:
090:            static Element fill(Document document, Node parent) {
091:                Element fill = element(SLD.FILL, document, parent);
092:
093:                css("fill", "#123456", document, fill);
094:                css("fill-opacity", "1.0", document, fill);
095:
096:                return fill;
097:            }
098:
099:            static Element stroke(Document document, Node parent) {
100:                Element stroke = element(SLD.STROKE, document, parent);
101:                css("stroke", "#123456", document, stroke);
102:                css("stroke-opacity", "1.0", document, stroke);
103:                css("stroke-width", "1.0", document, stroke);
104:                css("stroke-linejoin", "mitre", document, stroke);
105:                css("stroke-linecap", "butt", document, stroke);
106:                css("stroke-dasharray", "1.1 2.2 3.3 4.4", document, stroke);
107:                css("stroke-dashoffset", "1", document, stroke);
108:
109:                graphicFill(document, stroke);
110:
111:                return stroke;
112:            }
113:
114:            static Element wellKnownName(Document document, Node parent) {
115:                Element wkn = element(SLD.WELLKNOWNNAME, document, parent);
116:                wkn.appendChild(document.createTextNode("wellKnownName"));
117:
118:                return wkn;
119:            }
120:
121:            static Element mark(Document document, Node parent) {
122:                Element mark = element(SLD.MARK, document, parent);
123:                fill(document, mark);
124:                wellKnownName(document, mark);
125:
126:                return mark;
127:            }
128:
129:            static Element graphic(Document document, Node parent) {
130:                Element graphic = element(SLD.GRAPHIC, document, parent);
131:                mark(document, graphic);
132:                size(document, graphic);
133:                opacity(document, graphic);
134:                rotation(document, graphic);
135:
136:                return graphic;
137:            }
138:
139:            static Element graphicFill(Document document, Node parent) {
140:                Element graphicFill = element(SLD.GRAPHICFILL, document, parent);
141:                graphic(document, graphicFill);
142:
143:                return graphicFill;
144:            }
145:
146:            static Element graphicStroke(Document document, Node parent) {
147:                Element graphicStroke = element(SLD.GRAPHICSTROKE, document,
148:                        parent);
149:                graphic(document, graphicStroke);
150:
151:                return graphicStroke;
152:            }
153:
154:            static Element polygonSymbolizer(Document document, Node parent) {
155:                Element polygonSymbolizer = element(SLD.POLYGONSYMBOLIZER,
156:                        document, parent);
157:
158:                stroke(document, polygonSymbolizer);
159:                fill(document, polygonSymbolizer);
160:
161:                return polygonSymbolizer;
162:            }
163:
164:            static Element lineSymbolizer(Document document, Node parent) {
165:                Element lineSymbolizer = element(SLD.LINESYMBOLIZER, document,
166:                        parent);
167:
168:                stroke(document, lineSymbolizer);
169:
170:                return lineSymbolizer;
171:            }
172:
173:            static Element geometry(Document document, Node parent) {
174:                Element geometry = element(SLD.GEOMETRY, document, parent);
175:                Element propertyName = element(OGC.PropertyName, document,
176:                        geometry);
177:                propertyName.appendChild(document.createTextNode("the_geom"));
178:
179:                return geometry;
180:            }
181:
182:            static Element channelSelection(Document document, Node parent) {
183:                Element channelSelection = element(SLD.CHANNELSELECTION,
184:                        document, parent);
185:
186:                Element channel = element(SLD.REDCHANNEL, document,
187:                        channelSelection);
188:                Element sourceChannelName = element(SLD.SOURCECHANNELNAME,
189:                        document, channel);
190:                sourceChannelName.appendChild(document.createTextNode("Red"));
191:
192:                channel = element(SLD.GREENCHANNEL, document, channelSelection);
193:                sourceChannelName = element(SLD.SOURCECHANNELNAME, document,
194:                        channel);
195:                sourceChannelName.appendChild(document.createTextNode("Green"));
196:
197:                channel = element(SLD.BLUECHANNEL, document, channelSelection);
198:                sourceChannelName = element(SLD.SOURCECHANNELNAME, document,
199:                        channel);
200:                sourceChannelName.appendChild(document.createTextNode("Blue"));
201:
202:                channel = element(SLD.GRAYCHANNEL, document, channelSelection);
203:                sourceChannelName = element(SLD.SOURCECHANNELNAME, document,
204:                        channel);
205:                sourceChannelName.appendChild(document.createTextNode("Gray"));
206:
207:                return channelSelection;
208:            }
209:
210:            static Element colorMap(Document document, Node parent) {
211:                Element colorMap = element(SLD.COLORMAP, document, parent);
212:                Element colorMapEntry = element(SLD.COLORMAPENTRY, document,
213:                        colorMap);
214:                colorMapEntry.setAttribute("color", "#000000");
215:
216:                colorMapEntry = element(SLD.COLORMAPENTRY, document, colorMap);
217:                colorMapEntry.setAttribute("color", "#FFFFFF");
218:
219:                return colorMap;
220:            }
221:
222:            static Element overlapBehaviour(Document document, Node parent) {
223:                Element overlapBehaviour = element(SLD.OVERLAPBEHAVIOR,
224:                        document, parent);
225:                element(SLD.EARLIEST_ON_TOP, document, overlapBehaviour);
226:
227:                return overlapBehaviour;
228:            }
229:
230:            static Element contrastEnhancement(Document document, Node parent) {
231:                Element contrastEnhancement = element(SLD.CONTRASTENHANCEMENT,
232:                        document, parent);
233:
234:                Element gammaValue = element(SLD.GAMMAVALUE, document,
235:                        contrastEnhancement);
236:                gammaValue.appendChild(document.createTextNode("1.23"));
237:
238:                Element histogram = element(SLD.HISTOGRAM, document,
239:                        contrastEnhancement);
240:
241:                return contrastEnhancement;
242:            }
243:
244:            static Element shadedRelief(Document document, Node parent) {
245:                Element shadedRelief = element(SLD.SHADEDRELIEF, document,
246:                        parent);
247:                element(SLD.BRIGHTNESSONLY, document, shadedRelief, "true");
248:                element(SLD.RELIEFFACTOR, document, shadedRelief, "1.0");
249:
250:                return shadedRelief;
251:            }
252:
253:            static Element imageOutline(Document document, Node parent) {
254:                Element imageOutline = element(SLD.IMAGEOUTLINE, document,
255:                        parent);
256:                lineSymbolizer(document, imageOutline);
257:
258:                return imageOutline;
259:            }
260:
261:            static Element rasterSymbolizer(Document document, Node parent) {
262:                Element rasterSymbolizer = element(SLD.RASTERSYMBOLIZER,
263:                        document, parent);
264:
265:                geometry(document, rasterSymbolizer);
266:                opacity(document, rasterSymbolizer);
267:                channelSelection(document, rasterSymbolizer);
268:                overlapBehaviour(document, rasterSymbolizer);
269:                colorMap(document, rasterSymbolizer);
270:                contrastEnhancement(document, rasterSymbolizer);
271:                shadedRelief(document, rasterSymbolizer);
272:                imageOutline(document, rasterSymbolizer);
273:
274:                return rasterSymbolizer;
275:            }
276:
277:            static Element font(Document document, Node parent) {
278:                Element font = element(SLD.FONT, document, parent);
279:                css("font-family", "Arial", document, font);
280:                css("font-weight", "normal", document, font);
281:                css("font-size", "14", document, font);
282:                css("font-style", "normal", document, font);
283:
284:                return font;
285:            }
286:
287:            static Element label(Document document, Node parent) {
288:                return element(SLD.LABEL, document, parent, "label");
289:            }
290:
291:            static Element halo(Document document, Node parent) {
292:                Element halo = element(SLD.HALO, document, parent);
293:                fill(document, halo);
294:                element(SLD.RADIUS, document, halo, "1.0");
295:
296:                return halo;
297:            }
298:
299:            static Element textSymbolizer(Document document, Node parent) {
300:                Element textSymbolizer = element(SLD.TEXTSYMBOLIZER, document,
301:                        parent);
302:                geometry(document, textSymbolizer);
303:                label(document, textSymbolizer);
304:                font(document, textSymbolizer);
305:                pointPlacement(document, textSymbolizer);
306:                halo(document, textSymbolizer);
307:                fill(document, textSymbolizer);
308:
309:                return textSymbolizer;
310:            }
311:
312:            static Element pointSymbolizer(Document document, Node parent) {
313:                Element pointSymbolizer = element(SLD.POINTSYMBOLIZER,
314:                        document, parent);
315:
316:                geometry(document, pointSymbolizer);
317:                graphic(document, pointSymbolizer);
318:
319:                return pointSymbolizer;
320:            }
321:
322:            static Element legendGraphic(Document document, Node parent) {
323:                Element legendGraphic = element(SLD.LEGENDGRAPHIC, document,
324:                        parent);
325:                graphic(document, legendGraphic);
326:
327:                return legendGraphic;
328:            }
329:
330:            static Element filter(Document document, Node parent) {
331:                Element filter = element(OGC.Filter, document, parent);
332:                Element featureId = element(OGC.FeatureId, document, filter);
333:                featureId.setAttribute("fid", "someFid");
334:
335:                return filter;
336:            }
337:
338:            static Element rule(Document document, Node parent) {
339:                Element rule = element(SLD.RULE, document, parent);
340:                element(SLD.NAME, document, rule, "theName");
341:                element(SLD.TITLE, document, rule, "theTitle");
342:                element(SLD.ABSTRACT, document, rule, "theAbstract");
343:                legendGraphic(document, rule);
344:
345:                filter(document, rule);
346:
347:                element(SLD.MINSCALEDENOMINATOR, document, rule, "1.0");
348:                element(SLD.MAXSCALEDENOMINATOR, document, rule, "1.0");
349:
350:                pointSymbolizer(document, rule);
351:                lineSymbolizer(document, rule);
352:                polygonSymbolizer(document, rule);
353:                rasterSymbolizer(document, rule);
354:                textSymbolizer(document, rule);
355:
356:                return rule;
357:            }
358:
359:            static Element featureTypeStyle(Document document, Node parent) {
360:                Element featureTypeStyle = element(SLD.FEATURETYPESTYLE,
361:                        document, parent);
362:                element(SLD.NAME, document, featureTypeStyle, "theName");
363:                element(SLD.TITLE, document, featureTypeStyle, "theTitle");
364:                element(SLD.ABSTRACT, document, featureTypeStyle, "theAbstract");
365:                element(SLD.FEATURETYPENAME, document, featureTypeStyle,
366:                        "theFeatureTypeName");
367:
368:                element(SLD.SEMANTICTYPEIDENTIFIER, document, featureTypeStyle,
369:                        "semanticTypeId1");
370:                element(SLD.SEMANTICTYPEIDENTIFIER, document, featureTypeStyle,
371:                        "semanticTypeId2");
372:
373:                rule(document, featureTypeStyle);
374:                rule(document, featureTypeStyle);
375:
376:                return featureTypeStyle;
377:            }
378:
379:            static Element namedStyle(Document document, Node parent) {
380:                Element namedStyle = element(SLD.NAMEDSTYLE, document, parent);
381:                element(SLD.NAME, document, namedStyle, "theName");
382:
383:                return namedStyle;
384:            }
385:
386:            static Element userStyle(Document document, Node parent) {
387:                Element userStyle = element(SLD.USERSTYLE, document, parent);
388:
389:                element(SLD.NAME, document, userStyle, "theName");
390:                element(SLD.TITLE, document, userStyle, "theTitle");
391:                element(SLD.ABSTRACT, document, userStyle, "theAbstract");
392:                element(SLD.ISDEFAULT, document, userStyle, "true");
393:
394:                featureTypeStyle(document, userStyle);
395:                featureTypeStyle(document, userStyle);
396:
397:                return userStyle;
398:            }
399:
400:            static Element extent(Document document, Node parent) {
401:                Element extent = element(SLD.EXTENT, document, parent);
402:                element(SLD.NAME, document, extent, "theName");
403:                element(SLD.VALUE, document, extent, "theValue");
404:
405:                return extent;
406:            }
407:
408:            static Element featureTypeConstraint(Document document, Node parent) {
409:                Element featureTypeConstraint = element(
410:                        SLD.FEATURETYPECONSTRAINT, document, parent);
411:
412:                element(SLD.FEATURETYPENAME, document, featureTypeConstraint,
413:                        "theFeatureTypeName");
414:                filter(document, featureTypeConstraint);
415:                extent(document, featureTypeConstraint);
416:                extent(document, featureTypeConstraint);
417:
418:                return featureTypeConstraint;
419:            }
420:
421:            static Element layerFeatureConstraints(Document document,
422:                    Node parent) {
423:                Element layerFeatureConstraints = element(
424:                        SLD.LAYERFEATURECONSTRAINTS, document, parent);
425:
426:                featureTypeConstraint(document, layerFeatureConstraints);
427:                featureTypeConstraint(document, layerFeatureConstraints);
428:
429:                return layerFeatureConstraints;
430:            }
431:
432:            static Element namedLayer(Document document, Node parent) {
433:                Element namedLayer = element(SLD.NAMEDLAYER, document, parent);
434:                element(SLD.NAME, document, namedLayer, "theName");
435:
436:                return namedLayer;
437:            }
438:
439:            static Element userLayer(Document document, Node parent) {
440:                Element namedLayer = element(SLD.USERLAYER, document, parent);
441:
442:                element(SLD.NAME, document, namedLayer, "theName");
443:
444:                layerFeatureConstraints(document, namedLayer);
445:                userStyle(document, namedLayer);
446:                userStyle(document, namedLayer);
447:
448:                return namedLayer;
449:            }
450:
451:            static Element styledLayerDescriptor(Document document, Node parent) {
452:                Element sld = element(SLD.STYLEDLAYERDESCRIPTOR, document,
453:                        parent);
454:
455:                element(SLD.NAME, document, sld, "theName");
456:                element(SLD.TITLE, document, sld, "theTitle");
457:                element(SLD.ABSTRACT, document, sld, "theAbstract");
458:
459:                userLayer(document, sld);
460:                userLayer(document, sld);
461:
462:                return sld;
463:            }
464:
465:            static Element element(QName name, Document document, Node parent) {
466:                Element element = document.createElementNS(name
467:                        .getNamespaceURI(), name.getLocalPart());
468:
469:                if (parent != null) {
470:                    parent.appendChild(element);
471:                }
472:
473:                return element;
474:            }
475:
476:            static Element element(QName name, Document document, Node parent,
477:                    String text) {
478:                Element element = element(name, document, parent);
479:
480:                if (text != null) {
481:                    element.appendChild(document.createTextNode(text));
482:                }
483:
484:                return element;
485:            }
486:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.