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


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2004-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; either
009:         *    version 2.1 of the License, or (at your option) any later version.
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.data.wms.gce;
017:
018:        import java.util.Arrays;
019:        import java.util.HashMap;
020:        import java.util.List;
021:        import java.util.Map;
022:        import java.util.Set;
023:        import java.util.TreeSet;
024:
025:        import org.geotools.data.ows.Layer;
026:        import org.geotools.data.ows.WMSCapabilities;
027:        import org.geotools.data.wms.WMSUtils;
028:        import org.geotools.parameter.DefaultParameterDescriptor;
029:        import org.geotools.parameter.DefaultParameterDescriptorGroup;
030:        import org.geotools.referencing.AbstractIdentifiedObject;
031:        import org.opengis.layer.Style;
032:        import org.opengis.parameter.GeneralParameterDescriptor;
033:
034:        /**
035:         * DOCUMENT ME!
036:         *
037:         * @author Richard Gould TODO To change the template for this generated type
038:         *         comment go to Window - Preferences - Java - Code Style - Code
039:         *         Templates
040:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/wms/src/main/java/org/geotools/data/wms/gce/WMSParameterMaker.java $
041:         */
042:        public class WMSParameterMaker {
043:            private WMSCapabilities capabilities;
044:
045:            public WMSParameterMaker(WMSCapabilities capabilities) {
046:                this .capabilities = capabilities;
047:            }
048:
049:            private Map fillProperties(String name, String remarks) {
050:                Map properties = new HashMap();
051:
052:                properties.put(AbstractIdentifiedObject.NAME_KEY, name);
053:                properties.put(AbstractIdentifiedObject.REMARKS_KEY, remarks);
054:
055:                return properties;
056:            }
057:
058:            public GeneralParameterDescriptor createVersionReadParam() {
059:                String[] validValues = { "1.0.0", "1.1.0", "1.1.1", "1.3.0" };
060:
061:                Map properties = fillProperties("VERSION",
062:                        "Value contains the version of the WMS server to be used");
063:
064:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
065:                        properties, String.class, validValues, null, null,
066:                        null, null, true);
067:
068:                return param;
069:            }
070:
071:            public GeneralParameterDescriptor createFormatReadParam() {
072:                Map properties = fillProperties("FORMAT",
073:                        "Value contains the desired format");
074:
075:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
076:                        properties, String.class, capabilities.getRequest()
077:                                .getGetMap().getFormats().toArray(
078:                                        new String[capabilities.getRequest()
079:                                                .getGetMap().getFormats()
080:                                                .size()]), null, null, null,
081:                        null, true);
082:
083:                return param;
084:            }
085:
086:            public GeneralParameterDescriptor createRequestReadParam() {
087:                Map properties = fillProperties("REQUEST",
088:                        "Value contains the the type of the request");
089:                String getMap = "GetMap";
090:                String[] validValues = { getMap };
091:
092:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
093:                        properties, String.class, validValues, getMap, null,
094:                        null, null, true);
095:
096:                return param;
097:            }
098:
099:            public GeneralParameterDescriptor createSRSReadParam() {
100:                Map properties = fillProperties("SRS",
101:                        "Value contains the desired SRS for the entire map");
102:
103:                Set srs = new TreeSet();
104:                retrieveSRSs((Layer[]) capabilities.getLayerList().toArray(
105:                        new Layer[capabilities.getLayerList().size()]), srs);
106:
107:                Object[] validValues = (Object[]) srs.toArray();
108:
109:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
110:                        properties, String.class, validValues, null, null,
111:                        null, null, true);
112:
113:                return param;
114:            }
115:
116:            private void retrieveSRSs(Layer[] layers, Set srsSet) {
117:                for (int i = 0; i < layers.length; i++) {
118:                    if (layers[i].getSrs() != null) {
119:                        srsSet.addAll(layers[i].getSrs());
120:                    }
121:                }
122:            }
123:
124:            public GeneralParameterDescriptor createWidthReadParam() {
125:                Map properties = fillProperties("WIDTH",
126:                        "Value contains the width, in pixels, of the requested map");
127:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
128:                        properties, Integer.class, null, null, new Integer(1),
129:                        null, null, true);
130:
131:                return param;
132:            }
133:
134:            public GeneralParameterDescriptor createHeightReadParam() {
135:                Map properties = fillProperties("HEIGHT",
136:                        "Value contains the height, in pixels, of the requested map");
137:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
138:                        properties, Integer.class, null, null, new Integer(1),
139:                        null, null, true);
140:
141:                return param;
142:            }
143:
144:            public GeneralParameterDescriptor createLayersReadParam() {
145:                Map properties = fillProperties(
146:                        "LAYERS",
147:                        "Describes each layer in the WMS and the styles associated "
148:                                + "with. The parameter name is the name of the layer. The value"
149:                                + "is the style for that layer. The valid values are all the "
150:                                + "styles that layer can be drawn with.");
151:
152:                List layers = Arrays.asList(WMSUtils
153:                        .getNamedLayers(capabilities));
154:
155:                GeneralParameterDescriptor[] layerParams = new DefaultParameterDescriptor[layers
156:                        .size()];
157:
158:                for (int i = 0; i < layers.size(); i++) {
159:                    Layer layer = (Layer) layers.get(i);
160:
161:                    Map layerProperties = fillProperties(layer.getName(), "");
162:
163:                    String[] styles = new String[layer.getStyles().size()];
164:                    for (int j = 0; j < layer.getStyles().size(); j++) {
165:                        Style style = (Style) layer.getStyles().get(j);
166:                        styles[i] = style.getName();
167:                    }
168:
169:                    layerParams[i] = new DefaultParameterDescriptor(
170:                            layerProperties, String.class, styles, null, null,
171:                            null, null, false);
172:                }
173:
174:                GeneralParameterDescriptor param = new DefaultParameterDescriptorGroup(
175:                        properties, 0, layers.size(), layerParams);
176:
177:                return param;
178:            }
179:
180:            private GeneralParameterDescriptor createBBoxParam(
181:                    String coordDescriptor) {
182:                Map properties = fillProperties("BBOX_"
183:                        + coordDescriptor.toUpperCase(), "Value contains the "
184:                        + coordDescriptor + " value for the bounding box");
185:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
186:                        properties, Double.class, null, null, null, null, null,
187:                        true);
188:
189:                return param;
190:            }
191:
192:            public GeneralParameterDescriptor createBBoxMinXReadParam() {
193:                return createBBoxParam("minX");
194:            }
195:
196:            public GeneralParameterDescriptor createBBoxMinYReadParam() {
197:                return createBBoxParam("minY");
198:            }
199:
200:            public GeneralParameterDescriptor createBBoxMaxXReadParam() {
201:                return createBBoxParam("maxX");
202:            }
203:
204:            public GeneralParameterDescriptor createBBoxMaxYReadParam() {
205:                return createBBoxParam("maxY");
206:            }
207:
208:            public GeneralParameterDescriptor createTransparentReadParam() {
209:                Map properties = fillProperties("TRANSPARENT",
210:                        "Value indicates map transparency");
211:                Boolean[] validValues = { new Boolean(true), new Boolean(false) };
212:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
213:                        properties, Boolean.class, validValues, new Boolean(
214:                                false), null, null, null, false);
215:
216:                return param;
217:            }
218:
219:            public GeneralParameterDescriptor createBGColorReadParam() {
220:                Map properties = fillProperties("BGCOLOR",
221:                        "Value indicates map background colour in hex format (0xRRGGBB)");
222:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
223:                        properties, String.class, null, "0xFFFFFF", null, null,
224:                        null, false);
225:
226:                return param;
227:            }
228:
229:            public GeneralParameterDescriptor createExceptionsReadParam() {
230:                Map properties = fillProperties("EXCEPTIONS",
231:                        "Value indicates the format in which exceptions are returned");
232:                String defaultValue = "application/vnd.ogc.se_xml";
233:                String[] validValues = { defaultValue };
234:
235:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
236:                        properties, String.class, validValues, defaultValue,
237:                        null, null, null, false);
238:
239:                //TODO Fix exceptions later
240:                //param.validValues = new TreeSet(capabilities..getException().getFormats());
241:                return param;
242:            }
243:
244:            public GeneralParameterDescriptor createTimeReadParam() {
245:                Map properties = fillProperties("TIME",
246:                        "Value indicates the time value desired");
247:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
248:                        properties, String.class, null, null, null, null, null,
249:                        false);
250:
251:                return param;
252:            }
253:
254:            public GeneralParameterDescriptor createElevationReadParam() {
255:                Map properties = fillProperties("ELEVATION",
256:                        "Value indicates the elevation value desired");
257:                GeneralParameterDescriptor param = new DefaultParameterDescriptor(
258:                        properties, String.class, null, null, null, null, null,
259:                        false);
260:
261:                return param;
262:            }
263:
264:            //TODO support Sample dimensions
265:            //TODO support VendorSpecific Parameters.
266:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.