Source Code Cross Referenced for Layer.java in  » GIS » deegree » org » deegree » ogcwebservices » wms » capabilities » 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.ogcwebservices.wms.capabilities 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/ogcwebservices/wms/capabilities/Layer.java $
0002:        /*----------------    FILE HEADER  ------------------------------------------
0003:
0004:         This file is part of deegree.
0005:         Copyright (C) 2001-2008 by:
0006:         EXSE, Department of Geography, University of Bonn
0007:         http://www.giub.uni-bonn.de/deegree/
0008:         lat/lon GmbH
0009:         http://www.lat-lon.de
0010:
0011:         This library is free software; you can redistribute it and/or
0012:         modify it under the terms of the GNU Lesser General Public
0013:         License as published by the Free Software Foundation; either
0014:         version 2.1 of the License, or (at your option) any later version.
0015:
0016:         This library is distributed in the hope that it will be useful,
0017:         but WITHOUT ANY WARRANTY; without even the implied warranty of
0018:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0019:         Lesser General Public License for more details.
0020:
0021:         You should have received a copy of the GNU Lesser General Public
0022:         License along with this library; if not, write to the Free Software
0023:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0024:
0025:         Contact:
0026:
0027:         Andreas Poth
0028:         lat/lon GmbH
0029:         Aennchenstr. 19
0030:         53115 Bonn
0031:         Germany
0032:         E-Mail: poth@lat-lon.de
0033:
0034:         Prof. Dr. Klaus Greve
0035:         Department of Geography
0036:         University of Bonn
0037:         Meckenheimer Allee 166
0038:         53115 Bonn
0039:         Germany
0040:         E-Mail: greve@giub.uni-bonn.de
0041:
0042:        
0043:         ---------------------------------------------------------------------------*/
0044:        package org.deegree.ogcwebservices.wms.capabilities;
0045:
0046:        import java.util.ArrayList;
0047:        import java.util.Arrays;
0048:        import java.util.HashMap;
0049:        import java.util.List;
0050:
0051:        import org.deegree.graphics.sld.UserStyle;
0052:        import org.deegree.model.spatialschema.Envelope;
0053:        import org.deegree.ogcwebservices.getcapabilities.MetadataURL;
0054:        import org.deegree.ogcwebservices.wms.configuration.AbstractDataSource;
0055:
0056:        /**
0057:         * Each available map is advertised by a <Layer> element in the Capabilities XML. A single
0058:         * parent Layer encloses any number of additional layers, which may be hierarchically nested as
0059:         * desired. Some properties defined in a parent layer are inherited by the children it encloses.
0060:         * These inherited properties may be either redefined or added to by the child.
0061:         * <p>
0062:         * A Map Server shall include at least one &lt;Layer&gt; element for each map layer offered. If
0063:         * desired, layers may be repeated in different categories when relevant. No controlled vocabulary
0064:         * has been defined, so at present Layer and Style Names, Titles and Keywords are arbitrary.
0065:         * </p>
0066:         * The &lt;Layer&gt; element can enclose child elements providing metadata about the Layer.
0067:         * 
0068:         * @author <a href="mailto:k.lupp@web.de">Katharina Lupp </a>
0069:         * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider </a>
0070:         * @author last edited by: $Author: apoth $
0071:         * @version 2002-03-01
0072:         */
0073:        public class Layer {
0074:
0075:            private List<AuthorityURL> authorityURL;
0076:
0077:            private List<Envelope> boundingBox;
0078:
0079:            private List<AbstractDataSource> dataSource;
0080:
0081:            private List<DataURL> dataURL;
0082:
0083:            private List<Dimension> dimension;
0084:
0085:            private List<Extent> extent;
0086:
0087:            private List<FeatureListURL> featureListURL;
0088:
0089:            private List<Identifier> identifier;
0090:
0091:            private List<String> keywordList;
0092:
0093:            private List<Layer> layer;
0094:
0095:            private List<MetadataURL> metadataURL;
0096:
0097:            private List<String> srs;
0098:
0099:            private Attribution attribution;
0100:
0101:            private Envelope latLonBoundingBox;
0102:
0103:            private HashMap<String, Style> styles;
0104:
0105:            private Layer parent;
0106:
0107:            private ScaleHint scaleHint;
0108:
0109:            private String abstract_;
0110:
0111:            private String name;
0112:
0113:            private String title;
0114:
0115:            private boolean noSubsets = false;
0116:
0117:            private boolean opaque = false;
0118:
0119:            private boolean queryable = false;
0120:
0121:            private int cascaded = -1;
0122:
0123:            private int fixedHeight = -1;
0124:
0125:            private int fixedWidth = -1;
0126:
0127:            /**
0128:             * default constructor
0129:             */
0130:            private Layer() {
0131:                keywordList = new ArrayList<String>(20);
0132:                srs = new ArrayList<String>(20);
0133:                boundingBox = new ArrayList<Envelope>();
0134:                dimension = new ArrayList<Dimension>();
0135:                extent = new ArrayList<Extent>();
0136:                authorityURL = new ArrayList<AuthorityURL>();
0137:                identifier = new ArrayList<Identifier>();
0138:                metadataURL = new ArrayList<MetadataURL>();
0139:                dataURL = new ArrayList<DataURL>();
0140:                featureListURL = new ArrayList<FeatureListURL>();
0141:                styles = new HashMap<String, Style>();
0142:                layer = new ArrayList<Layer>(50);
0143:                dataSource = new ArrayList<AbstractDataSource>();
0144:            }
0145:
0146:            /**
0147:             * constructor initializing the class with the &lt;Layer&gt;
0148:             * 
0149:             * @param queryable
0150:             * @param cascaded
0151:             * @param opaque
0152:             * @param noSubsets
0153:             * @param fixedWidth
0154:             * @param fixedHeight
0155:             * @param name
0156:             * @param title
0157:             * @param abstract_
0158:             * @param latLonBoundingBox
0159:             * @param attribution
0160:             * @param scaleHint
0161:             * @param keywordList
0162:             * @param srs
0163:             * @param boundingBoxes
0164:             * @param dimensions
0165:             * @param extents
0166:             * @param authorityURLs
0167:             * @param identifiers
0168:             * @param metadataURLs
0169:             * @param dataURLs
0170:             * @param featureListURLs
0171:             * @param styles
0172:             * @param layers
0173:             * @param dataSource
0174:             * @param parent
0175:             */
0176:            public Layer(boolean queryable, int cascaded, boolean opaque,
0177:                    boolean noSubsets, int fixedWidth, int fixedHeight,
0178:                    String name, String title, String abstract_,
0179:                    Envelope latLonBoundingBox, Attribution attribution,
0180:                    ScaleHint scaleHint, String[] keywordList, String[] srs,
0181:                    LayerBoundingBox[] boundingBoxes, Dimension[] dimensions,
0182:                    Extent[] extents, AuthorityURL[] authorityURLs,
0183:                    Identifier[] identifiers, MetadataURL[] metadataURLs,
0184:                    DataURL[] dataURLs, FeatureListURL[] featureListURLs,
0185:                    Style[] styles, Layer[] layers,
0186:                    AbstractDataSource[] dataSource, Layer parent) {
0187:                this ();
0188:                this .queryable = queryable;
0189:                this .cascaded = cascaded;
0190:                this .opaque = opaque;
0191:                this .noSubsets = noSubsets;
0192:                this .fixedWidth = fixedWidth;
0193:                this .fixedHeight = fixedHeight;
0194:                setName(name);
0195:                setTitle(title);
0196:                setAbstract(abstract_);
0197:                setLatLonBoundingBox(latLonBoundingBox);
0198:                setAttribution(attribution);
0199:                setScaleHint(scaleHint);
0200:                setKeywordList(keywordList);
0201:                setSrs(srs);
0202:                setBoundingBox(boundingBoxes);
0203:                setDimension(dimensions);
0204:                setExtent(extents);
0205:                setAuthorityURL(authorityURLs);
0206:                setIdentifier(identifiers);
0207:                setMetadataURL(metadataURLs);
0208:                setDataURL(dataURLs);
0209:                setFeatureListURL(featureListURLs);
0210:                setStyles(styles);
0211:                setLayer(layers);
0212:                setDataSource(dataSource);
0213:                setParent(parent);
0214:            }
0215:
0216:            /**
0217:             * If, and only if, a layer has a &lt;Name&gt;, then it is a map layer that can be requested by
0218:             * using that Name in the LAYERS parameter of a GetMap request. If the layer has a Title but no
0219:             * Name, then that layer is only a category title for all the layers nested within. A Map Server
0220:             * that advertises a Layer containing a Name element shall be able to accept that Name as the
0221:             * value of LAYERS argument in a GetMap request and return the corresponding map. A Client shall
0222:             * not attempt to request a layer that has a Title but no Name.
0223:             * 
0224:             * @return the name
0225:             */
0226:            public String getName() {
0227:                return name;
0228:            }
0229:
0230:            /**
0231:             * sets the name of the layer
0232:             * 
0233:             * @param name
0234:             */
0235:            public void setName(String name) {
0236:                this .name = name;
0237:            }
0238:
0239:            /**
0240:             * A &lt;Title&gt; is required for all layers; it is a human-readable string for presentation in
0241:             * a menu. The Title is not inherited by child Layers.
0242:             * 
0243:             * @return the title
0244:             */
0245:            public String getTitle() {
0246:                return title;
0247:            }
0248:
0249:            /**
0250:             * sets the title for the layer
0251:             * 
0252:             * @param title
0253:             */
0254:            public void setTitle(String title) {
0255:                this .title = title;
0256:            }
0257:
0258:            /**
0259:             * Abstract is a narrative description of the map layer. The Abstract elements are not inherited
0260:             * by child Layers.
0261:             * 
0262:             * @return the abstract
0263:             */
0264:            public String getAbstract() {
0265:                return abstract_;
0266:            }
0267:
0268:            /**
0269:             * sets the a narrative description of the map layer
0270:             * 
0271:             * @param abstract_
0272:             */
0273:            public void setAbstract(String abstract_) {
0274:                this .abstract_ = abstract_;
0275:            }
0276:
0277:            /**
0278:             * KeywordList contains zero or more Keywords to aid in catalog searches. The KeywordList
0279:             * elements are not inherited by child Layers.
0280:             * 
0281:             * @return the keywords
0282:             */
0283:            public String[] getKeywordList() {
0284:                return keywordList.toArray(new String[keywordList.size()]);
0285:            }
0286:
0287:            /**
0288:             * adds the keywordList
0289:             * 
0290:             * @param keyword
0291:             */
0292:            public void addKeyword(String keyword) {
0293:                this .keywordList.add(keyword);
0294:            }
0295:
0296:            /**
0297:             * sets the keywordList
0298:             * 
0299:             * @param keywordList
0300:             */
0301:            public void setKeywordList(String[] keywordList) {
0302:                if (keywordList == null)
0303:                    this .keywordList.clear();
0304:                else
0305:                    this .keywordList = Arrays.asList(keywordList);
0306:            }
0307:
0308:            /**
0309:             * Every Layer is available in one or more spatial reference systems Every Layer shall have at
0310:             * least one &gt;SRS&gt; element that is either stated explicitly or inherited from a parent
0311:             * Layer . The root &lt;Layer&gt; element shall include a sequence of zero or more SRS elements
0312:             * listing all SRSes that are common to all subsidiary layers. Use a single SRS element with
0313:             * empty content (like so: "&lt;SRS&gt;&lt;/SRS&gt; ") if there is no common SRS. Layers may
0314:             * optionally add to the global SRS list, or to the list inherited from a parent layer. Any
0315:             * duplication shall be ignored by clients. When a Layer is available in several Spatial
0316:             * Reference Systems, there are two ways to encode the list of SRS values. The first of these is
0317:             * new in this version of the specification, the second is deprecated but still included for
0318:             * backwards compatibility.
0319:             * <p>
0320:             * 1. Optional, recommended: Multiple single-valued &lt;SRS&gt; elements: a list of SRS values
0321:             * is represented as a sequence of &lt;SRS&gt; elements, each of which contains only a single
0322:             * SRS name. Example: &lt;SRS&gt;EPSG:1234&lt;/SRS&gt; &lt;SRS&gt;EPSG:5678&lt;/SRS&gt;.
0323:             * </p>
0324:             * 2. Deprecated: Single list-valued &lt;SRS&gt; element: a list of SRS values is represented
0325:             * asa whitespace-separated list of SRS names contained within a single &lt;SRS&gt; element.
0326:             * Example: &lt;SRS&gt;EPSG:1234 EPSG:5678&lt;/SRS&gt;.
0327:             * 
0328:             * @return the srs
0329:             */
0330:            public String[] getSrs() {
0331:                String[] pSrs = null;
0332:
0333:                if (parent != null) {
0334:                    pSrs = parent.getSrs();
0335:                } else {
0336:                    pSrs = new String[0];
0337:                }
0338:
0339:                List<String> list = new ArrayList<String>(srs.size()
0340:                        + pSrs.length);
0341:                list.addAll(srs);
0342:                for (int i = 0; i < pSrs.length; i++) {
0343:                    if (!list.contains(pSrs[i])) {
0344:                        list.add(pSrs[i]);
0345:                    }
0346:                }
0347:
0348:                return list.toArray(new String[list.size()]);
0349:            }
0350:
0351:            /**
0352:             * @param srs
0353:             * @return s true if the submitted srs (name) is supported by the layer
0354:             */
0355:            public boolean isSrsSupported(String srs) {
0356:                String[] sr = getSrs();
0357:                for (int i = 0; i < sr.length; i++) {
0358:                    if (sr[i].equals(srs)) {
0359:                        return true;
0360:                    }
0361:                }
0362:                return false;
0363:            }
0364:
0365:            /**
0366:             * adds the spatial reference system (srs)
0367:             * 
0368:             * @param srs
0369:             */
0370:            public void addSrs(String srs) {
0371:                this .srs.add(srs);
0372:            }
0373:
0374:            /**
0375:             * sets the srs
0376:             * 
0377:             * @param srs
0378:             */
0379:            public void setSrs(String[] srs) {
0380:                if (srs == null)
0381:                    this .srs.clear();
0382:                else
0383:                    this .srs = Arrays.asList(srs);
0384:            }
0385:
0386:            /**
0387:             * Every Layer shall have exactly one &lt;LatLonBoundingBox&gt; element that is either stated
0388:             * explicitly or inherited from a parent Layer. LatLonBoundingBox states the minimum bounding
0389:             * rectangle of the map data in the EPSG:4326 geographic coordinate system. The
0390:             * LatLonBoundingBox attributes minx, miny, maxx, maxy indicate the edges of an enclosing
0391:             * rectangle in decimal degrees. LatLonBoundingBox shall be supplied regardless of what SRS the
0392:             * map server may support, but it may be approximate if EPSG:4326 is not supported. Its purpose
0393:             * is to facilitate geographic searches without requiring coordinate transformations by the
0394:             * search engine.
0395:             * 
0396:             * @return the bbox
0397:             */
0398:            public Envelope getLatLonBoundingBox() {
0399:                if ((latLonBoundingBox == null) && (parent != null)) {
0400:                    return parent.getLatLonBoundingBox();
0401:                }
0402:                return latLonBoundingBox;
0403:            }
0404:
0405:            /**
0406:             * sets the LatLonBoundingBox element that is either stated explicitly or inherited from a
0407:             * parent Layer.
0408:             * 
0409:             * @param latLonBoundingBox
0410:             */
0411:            public void setLatLonBoundingBox(Envelope latLonBoundingBox) {
0412:                this .latLonBoundingBox = latLonBoundingBox;
0413:            }
0414:
0415:            /**
0416:             * Layers may have zero or more &lt;BoundingBox&gt; elements that are either stated explicitly
0417:             * or inherited from a parent Layer. Each BoundingBox states the bounding rectangle of the map
0418:             * data in a particular spatial reference system; the attribute SRS indicates which SRS applies.
0419:             * If the data area is shaped irregularly then the BoundingBox gives the minimum enclosing
0420:             * rectangle. The attributes minx, miny, maxx, maxy indicate the edges of the bounding box in
0421:             * units of the specified SRS. Optional resx and resy attributes indicate the spatial resolution
0422:             * of the data in those same units.
0423:             * <p>
0424:             * A Layer may have multiple BoundingBox element, but each one shall state a different SRS. A
0425:             * Layer inherits any BoundingBox values defined by its parents. A BoundingBox inherited from
0426:             * the parent Layer for a particular SRS is replaced by any declaration for the same SRS in the
0427:             * child Layer. A BoundingBox in the child for a new SRS not already declared by the parent is
0428:             * added to the list of bounding boxes for the child Layer. A single Layer element shall not
0429:             * contain more than one BoundingBox for the same SRS.
0430:             * </p>
0431:             * 
0432:             * @return bounding boxes
0433:             */
0434:            public LayerBoundingBox[] getBoundingBoxes() {
0435:                HashMap<String, LayerBoundingBox> list = new HashMap<String, LayerBoundingBox>(
0436:                        100);
0437:
0438:                if (parent != null) {
0439:                    LayerBoundingBox[] plb = parent.getBoundingBoxes();
0440:
0441:                    for (int i = 0; i < plb.length; i++) {
0442:                        list.put(plb[i].getSRS(), plb[i]);
0443:                    }
0444:                }
0445:
0446:                for (int i = 0; i < boundingBox.size(); i++) {
0447:                    LayerBoundingBox lb = (LayerBoundingBox) boundingBox.get(i);
0448:                    list.put(lb.getSRS(), lb);
0449:                }
0450:
0451:                LayerBoundingBox[] lbs = new LayerBoundingBox[list.size()];
0452:                return list.values().toArray(lbs);
0453:            }
0454:
0455:            /**
0456:             * adds the &lt;BoundingBox&gt;
0457:             * 
0458:             * @param boundingBox
0459:             */
0460:            public void addBoundingBox(Envelope boundingBox) {
0461:                this .boundingBox.add(boundingBox);
0462:            }
0463:
0464:            /**
0465:             * sets the boundingBox
0466:             * 
0467:             * @param boundingBox
0468:             */
0469:            public void setBoundingBox(LayerBoundingBox[] boundingBox) {
0470:                this .boundingBox.clear();
0471:
0472:                if (boundingBox != null) {
0473:                    for (int i = 0; i < boundingBox.length; i++) {
0474:                        this .boundingBox.add(boundingBox[i]);
0475:                    }
0476:                }
0477:            }
0478:
0479:            /**
0480:             * Dimension declarations are inherited from parent Layers. Any new Dimension declarations in
0481:             * the child are added to the list inherited from the parent. A child shall not redefine a
0482:             * Dimension with the same name attribute as one that was inherited.
0483:             * 
0484:             * @return the dimensions
0485:             */
0486:            public Dimension[] getDimension() {
0487:                HashMap<String, Dimension> list = new HashMap<String, Dimension>();
0488:
0489:                if (parent != null) {
0490:                    Dimension[] pDim = parent.getDimension();
0491:
0492:                    for (int i = 0; i < pDim.length; i++) {
0493:                        list.put(pDim[i].getName(), pDim[i]);
0494:                    }
0495:                }
0496:
0497:                for (int i = 0; i < dimension.size(); i++) {
0498:                    Dimension dim = dimension.get(i);
0499:
0500:                    if (list.get(dim.getName()) == null) {
0501:                        list.put(dim.getName(), dim);
0502:                    }
0503:                }
0504:
0505:                return list.values().toArray(new Dimension[list.size()]);
0506:            }
0507:
0508:            /**
0509:             * adds the dimension
0510:             * 
0511:             * @param dimension
0512:             */
0513:            public void addDimension(Dimension dimension) {
0514:                this .dimension.add(dimension);
0515:            }
0516:
0517:            /**
0518:             * sets the dimension
0519:             * 
0520:             * @param dimension
0521:             */
0522:            public void setDimension(Dimension[] dimension) {
0523:                if (dimension == null)
0524:                    this .dimension.clear();
0525:                else
0526:                    this .dimension = Arrays.asList(dimension);
0527:            }
0528:
0529:            /**
0530:             * Extent declarations are inherited from parent Layers. Any Extent declarations in the child
0531:             * with the same name attribute as one inherited from the parent replaces the value declared by
0532:             * the parent. A Layer shall not declare an Extent unless a Dimension with the same name has
0533:             * been declared or inherited earlier in the Capabilities XML.
0534:             * 
0535:             * @return the extents
0536:             */
0537:            public Extent[] getExtent() {
0538:                HashMap<String, Extent> list = new HashMap<String, Extent>();
0539:
0540:                if (parent != null) {
0541:                    Extent[] pEx = parent.getExtent();
0542:
0543:                    for (int i = 0; i < pEx.length; i++) {
0544:                        list.put(pEx[i].getName(), pEx[i]);
0545:                    }
0546:                }
0547:
0548:                for (int i = 0; i < extent.size(); i++) {
0549:                    Extent ex = extent.get(i);
0550:                    list.put(ex.getName(), ex);
0551:                }
0552:
0553:                return list.values().toArray(new Extent[list.size()]);
0554:            }
0555:
0556:            /**
0557:             * adds the extent declarations
0558:             * 
0559:             * @param extent
0560:             */
0561:            public void addExtent(Extent extent) {
0562:                this .extent.add(extent);
0563:            }
0564:
0565:            /**
0566:             * sets the extent
0567:             * 
0568:             * @param extent
0569:             */
0570:            public void setExtent(Extent[] extent) {
0571:                if (extent == null)
0572:                    this .extent.clear();
0573:                else
0574:                    this .extent = Arrays.asList(extent);
0575:            }
0576:
0577:            /**
0578:             * The optional &lt;Attribution&gt; element provides a way to identify the source of the map
0579:             * data used in a Layer or collection of Layers. Attribution encloses several optional elements:
0580:             * <OnlineResource>states the data provider's URL; &lt;Title&gt; is a human-readable string
0581:             * naming the data provider; &lt;LogoURL&gt; is the URL of a logo image. Client applications may
0582:             * choose to display one or more of these items. A &lt;Format&gt; element in LogoURL indicates
0583:             * the MIME type of the logo image, and the attributes width and height state the size of the
0584:             * image in pixels.
0585:             * 
0586:             * @return the attribution
0587:             */
0588:            public Attribution getAttribution() {
0589:                if ((parent != null) && (attribution == null)) {
0590:                    return parent.getAttribution();
0591:                }
0592:                return attribution;
0593:            }
0594:
0595:            /**
0596:             * sets the optional &lt;Attribution&gt; element
0597:             * 
0598:             * @param attribution
0599:             */
0600:            public void setAttribution(Attribution attribution) {
0601:                this .attribution = attribution;
0602:            }
0603:
0604:            /**
0605:             * The authority attribute of the Identifier element corresponds to the name attribute of a
0606:             * separate &lt;AuthorityURL&gt; element. AuthorityURL encloses an &lt;OnlineResource&gt;
0607:             * element which states the URL of a document defining the meaning of the Identifier values.
0608:             * 
0609:             * @return the authority url object
0610:             */
0611:            public AuthorityURL[] getAuthorityURL() {
0612:                HashMap<String, AuthorityURL> list = new HashMap<String, AuthorityURL>();
0613:
0614:                if (parent != null) {
0615:                    AuthorityURL[] pAu = parent.getAuthorityURL();
0616:
0617:                    for (int i = 0; i < pAu.length; i++) {
0618:                        list.put(pAu[i].getName(), pAu[i]);
0619:                    }
0620:                }
0621:
0622:                for (int i = 0; i < authorityURL.size(); i++) {
0623:                    AuthorityURL au = authorityURL.get(i);
0624:
0625:                    if (list.get(au.getName()) == null) {
0626:                        list.put(au.getName(), au);
0627:                    }
0628:                }
0629:
0630:                AuthorityURL[] aus = new AuthorityURL[list.size()];
0631:                return list.values().toArray(aus);
0632:            }
0633:
0634:            /**
0635:             * adds the authority attribute of the Identifier element
0636:             * 
0637:             * @param authorityURL
0638:             */
0639:            public void addAuthorityURL(AuthorityURL authorityURL) {
0640:                this .authorityURL.add(authorityURL);
0641:            }
0642:
0643:            /**
0644:             * sets the authority attribute of the Identifier element
0645:             * 
0646:             * @param authorityURL
0647:             */
0648:            public void setAuthorityURL(AuthorityURL[] authorityURL) {
0649:                if (authorityURL == null)
0650:                    this .authorityURL.clear();
0651:                else
0652:                    this .authorityURL = Arrays.asList(authorityURL);
0653:            }
0654:
0655:            /**
0656:             * A Map Server may use zero or more &lt;Identifier&gt; elements to list ID numbers or labels
0657:             * defined by a particular Authority. The text content of the Identifier element is the ID
0658:             * value.
0659:             * 
0660:             * @return the identifiers
0661:             */
0662:            public Identifier[] getIdentifier() {
0663:                HashMap<String, Identifier> list = new HashMap<String, Identifier>();
0664:
0665:                if (parent != null) {
0666:                    Identifier[] pIden = parent.getIdentifier();
0667:
0668:                    for (int i = 0; i < pIden.length; i++) {
0669:                        list.put(pIden[i].getAuthority(), pIden[i]);
0670:                    }
0671:                }
0672:
0673:                for (int i = 0; i < identifier.size(); i++) {
0674:                    Identifier iden = identifier.get(i);
0675:
0676:                    if (list.get(iden.getAuthority()) == null) {
0677:                        list.put(iden.getAuthority(), iden);
0678:                    }
0679:                }
0680:
0681:                Identifier[] ids = new Identifier[list.size()];
0682:                return list.values().toArray(ids);
0683:            }
0684:
0685:            /**
0686:             * adds the &lt;Identifier&gt;
0687:             * 
0688:             * @param identifier
0689:             */
0690:            public void addIdentifier(Identifier identifier) {
0691:                this .identifier.add(identifier);
0692:            }
0693:
0694:            /**
0695:             * sets the &lt;Identifier&gt;
0696:             * 
0697:             * @param identifier
0698:             */
0699:            public void setIdentifier(Identifier[] identifier) {
0700:                if (identifier == null)
0701:                    this .identifier.clear();
0702:                else
0703:                    this .identifier = Arrays.asList(identifier);
0704:            }
0705:
0706:            /**
0707:             * A Map Server should use one or more &lt;MetadataURL&gt; elements to offer detailed,
0708:             * standardized metadata about the data underneath a particular layer. The type attribute
0709:             * indicates the standard to which the metadata complies. Two types are defined at present: the
0710:             * value 'TC211' refers to [ISO 19115]; the value 'FGDC' refers to [FGDC-STD-001-1988]. The
0711:             * MetadataURL element shall not be used to reference metadata in a non-standardized metadata
0712:             * format; see DataURL instead. The enclosed &lt;Format&gt; element indicates the file format
0713:             * MIME type of the metadata record.
0714:             * 
0715:             * @return the metadata urls
0716:             */
0717:            public MetadataURL[] getMetadataURL() {
0718:                return metadataURL.toArray(new MetadataURL[metadataURL.size()]);
0719:            }
0720:
0721:            /**
0722:             * adds the metadataURL
0723:             * 
0724:             * @param metadataURL
0725:             */
0726:            public void addMetadataURL(MetadataURL metadataURL) {
0727:                this .metadataURL.add(metadataURL);
0728:            }
0729:
0730:            /**
0731:             * sets the metadataURL
0732:             * 
0733:             * @param metadataURL
0734:             */
0735:            public void setMetadataURL(MetadataURL[] metadataURL) {
0736:                if (metadataURL == null)
0737:                    this .metadataURL.clear();
0738:                else
0739:                    this .metadataURL = Arrays.asList(metadataURL);
0740:            }
0741:
0742:            /**
0743:             * A Map Server may use DataURL to offer more information about the data represented by a
0744:             * particular layer. While the semantics are not well-defined, as long as the results of an HTTP
0745:             * GET request against the DataURL are properly MIME-typed, Viewer Clients and Cascading Map
0746:             * Servers can make use of this. Use 6lt;MetadataURL&gt; instead for a precisely defined
0747:             * reference to standardized metadata records.
0748:             * 
0749:             * @return the data URLs
0750:             */
0751:            public DataURL[] getDataURL() {
0752:                return dataURL.toArray(new DataURL[dataURL.size()]);
0753:            }
0754:
0755:            /**
0756:             * adds the dataURL
0757:             * 
0758:             * @param dataURL
0759:             */
0760:            public void addDataURL(DataURL dataURL) {
0761:                this .dataURL.add(dataURL);
0762:            }
0763:
0764:            /**
0765:             * sets the dataURL
0766:             * 
0767:             * @param dataURL
0768:             */
0769:            public void setDataURL(DataURL[] dataURL) {
0770:                if (dataURL == null)
0771:                    this .dataURL.clear();
0772:                else
0773:                    this .dataURL = Arrays.asList(dataURL);
0774:            }
0775:
0776:            /**
0777:             * A Map Server may use a &lt;FeatureListURL&gt; element to point to a list of the features
0778:             * represented in a Layer.
0779:             * 
0780:             * @return the feature list urls
0781:             */
0782:            public FeatureListURL[] getFeatureListURL() {
0783:                return featureListURL.toArray(new FeatureListURL[featureListURL
0784:                        .size()]);
0785:            }
0786:
0787:            /**
0788:             * adds the &lt;FeatureListURL&gt;
0789:             * 
0790:             * @param featureListURL
0791:             */
0792:            public void addFeatureListURL(FeatureListURL featureListURL) {
0793:                this .featureListURL.add(featureListURL);
0794:            }
0795:
0796:            /**
0797:             * sets the &lt;FeatureListURL&gt;
0798:             * 
0799:             * @param featureListURL
0800:             */
0801:            public void setFeatureListURL(FeatureListURL[] featureListURL) {
0802:                if (featureListURL == null)
0803:                    this .featureListURL.clear();
0804:                else
0805:                    this .featureListURL = Arrays.asList(featureListURL);
0806:            }
0807:
0808:            /**
0809:             * @return a list of style that can be used form rendering the layer.
0810:             */
0811:            public Style[] getStyles() {
0812:                HashMap<String, Style> list = new HashMap<String, Style>();
0813:
0814:                if (parent != null) {
0815:                    Style[] pStyle = parent.getStyles();
0816:
0817:                    for (int i = 0; i < pStyle.length; i++) {
0818:                        list.put(pStyle[i].getName(), pStyle[i]);
0819:                    }
0820:                }
0821:
0822:                for (Style style : styles.values()) {
0823:                    if (list.get(style.getName()) == null) {
0824:                        list.put(style.getName(), style);
0825:                    }
0826:                }
0827:
0828:                return list.values().toArray(new Style[list.size()]);
0829:            }
0830:
0831:            /**
0832:             * adds a list of style that can be used form rendering the layer.
0833:             * 
0834:             * @param style
0835:             */
0836:            public void addStyles(Style style) {
0837:                this .styles.put(style.getName(), style);
0838:            }
0839:
0840:            /**
0841:             * sets a list of style that can be used form rendering the layer.
0842:             * 
0843:             * @param styles
0844:             */
0845:            public void setStyles(Style[] styles) {
0846:                if (styles == null) {
0847:                    this .styles.clear();
0848:                } else {
0849:                    for (Style style : styles) {
0850:                        this .styles.put(style.getName(), style);
0851:                    }
0852:                }
0853:            }
0854:
0855:            /**
0856:             * returns the <tt>UserStyle</tt> (SLD) representation of the style identified by the
0857:             * submitted name.
0858:             * 
0859:             * @param name
0860:             *            of the requested style
0861:             * @return SLD - UserStyle
0862:             * 
0863:             */
0864:            public UserStyle getStyle(String name) {
0865:
0866:                Style style = styles.get(name);
0867:                UserStyle us = null;
0868:
0869:                if (style == null) {
0870:                    if (parent != null) {
0871:                        us = parent.getStyle(name);
0872:                    }
0873:                } else {
0874:                    us = style.getStyleContent();
0875:                }
0876:
0877:                return us;
0878:            }
0879:
0880:            /**
0881:             * returns the <tt>Style</tt> identified by the submitted name.
0882:             * 
0883:             * @param name
0884:             *            of the requested style
0885:             * @return Style
0886:             * 
0887:             */
0888:            public Style getStyleResource(String name) {
0889:
0890:                Style style = styles.get(name);
0891:
0892:                if (style == null && name.length() == 0) {
0893:                    String tmpName = "default";
0894:                    style = styles.get(tmpName);
0895:                    if (style == null && name.length() == 0) {
0896:                        tmpName = "default:" + this .name;
0897:                        style = styles.get(tmpName);
0898:                    }
0899:                } else if (style == null && "default".equals(name)) {
0900:                    String tmpName = "default:" + this .name;
0901:                    style = styles.get(tmpName);
0902:                }
0903:
0904:                if (style == null) {
0905:                    if (parent != null) {
0906:                        style = parent.getStyleResource(name);
0907:                    }
0908:                }
0909:
0910:                return style;
0911:            }
0912:
0913:            /**
0914:             * Layers may include a &lt;ScaleHint&gt; element that suggests minimum and maximum scales for
0915:             * which it is appropriate to display this layer. Because WMS output is destined for output
0916:             * devices of arbitrary size and resolution, the usual definition of scale as the ratio of map
0917:             * size to real-world size is not appropriate here. The following definition of Scale Hint is
0918:             * recommended. Consider a hypothetical map with a given Bounding Box, width and height. The
0919:             * central pixel of that map (or the pixel just to the northwest of center) will have some size,
0920:             * which can be expressed as the ground distance in meters of the southwest to northeast
0921:             * diagonal of that pixel. The two values in ScaleHint are the minimum and maximum recommended
0922:             * values of that diagonal. It is recognized that this definition is not geodetically precise,
0923:             * but at the same time the hope is that by including it conventions will develop that can be
0924:             * later specified more clearly.
0925:             * 
0926:             * @return the scale hint
0927:             */
0928:            public ScaleHint getScaleHint() {
0929:                if ((parent != null) && (scaleHint == null)) {
0930:                    return parent.getScaleHint();
0931:                }
0932:                return scaleHint;
0933:            }
0934:
0935:            /**
0936:             * sets the <ScaleHint>
0937:             * 
0938:             * @param scaleHint
0939:             */
0940:            public void setScaleHint(ScaleHint scaleHint) {
0941:                this .scaleHint = scaleHint;
0942:            }
0943:
0944:            /**
0945:             * returns a list of layers the are enclosed by this layer.
0946:             * 
0947:             * @return the layers
0948:             */
0949:            public Layer[] getLayer() {
0950:                return layer.toArray(new Layer[layer.size()]);
0951:            }
0952:
0953:            /**
0954:             * removes a Layer identified by its name from the parent Layer. A reference to the removed
0955:             * layer will be returned. If no Layer matching the passed name can be found nothing happens and
0956:             * <tt>null</tt> will be returned.
0957:             * 
0958:             * @param name
0959:             * 
0960:             * @return removerd Layer
0961:             */
0962:            public Layer removeLayer(String name) {
0963:                for (int i = 0; i < layer.size(); i++) {
0964:                    Layer ly = layer.get(i);
0965:                    if (ly.getName() != null) {
0966:                        if (ly.getName().equals(name)) {
0967:                            layer.remove(i);
0968:                            return ly;
0969:                        }
0970:                    }
0971:                }
0972:                return null;
0973:            }
0974:
0975:            /**
0976:             * removes a Layer identified by its title from the parent Layer. A reference to the removed
0977:             * layer will be returned. If no Layer matching the passed title can be found nothing happens
0978:             * and <tt>null</tt> will be returned.
0979:             * 
0980:             * @param title
0981:             * 
0982:             * @return removerd Layer
0983:             */
0984:            public Layer removeLayerByTitle(String title) {
0985:                for (int i = 0; i < layer.size(); i++) {
0986:                    Layer ly = layer.get(i);
0987:                    if (ly.getTitle().equals(title)) {
0988:                        layer.remove(i);
0989:                        return ly;
0990:                    }
0991:                }
0992:                return null;
0993:            }
0994:
0995:            /**
0996:             * adds a list of layers the are enclosed by this layer.
0997:             * 
0998:             * @param layer
0999:             */
1000:            public void addLayer(Layer layer) {
1001:                this .layer.add(layer);
1002:            }
1003:
1004:            /**
1005:             * sets a list of layers the are enclosed by this layer.
1006:             * 
1007:             * @param layer
1008:             */
1009:            public void setLayer(Layer[] layer) {
1010:                if (layer == null) {
1011:                    this .layer.clear();
1012:                } else {
1013:                    this .layer = new ArrayList<Layer>(Arrays.asList(layer));
1014:                }
1015:            }
1016:
1017:            /**
1018:             * source where the WMS can find the data of a layer.
1019:             * 
1020:             * @return the data sources
1021:             */
1022:            public AbstractDataSource[] getDataSource() {
1023:                return dataSource.toArray(new AbstractDataSource[dataSource
1024:                        .size()]);
1025:            }
1026:
1027:            /**
1028:             * source where the WMS can find the data of a layer.
1029:             * 
1030:             * @param dataSource
1031:             */
1032:            public void setDataSource(AbstractDataSource[] dataSource) {
1033:                if (dataSource == null)
1034:                    this .dataSource.clear();
1035:                else
1036:                    this .dataSource = Arrays.asList(dataSource);
1037:            }
1038:
1039:            /**
1040:             * source where the WMS can find the data of a layer.
1041:             * 
1042:             * @param dataSource
1043:             */
1044:            public void addDataSource(AbstractDataSource dataSource) {
1045:                this .dataSource.add(dataSource);
1046:            }
1047:
1048:            /**
1049:             * @return the parent layer of this layer. If the method returns <tt>null</tt> the current
1050:             *         layer is the root layer. In addition with the <tt>getLayer</tt> method this enables
1051:             *         a program to traverse the layer tree in both directions.
1052:             */
1053:            public Layer getParent() {
1054:                return parent;
1055:            }
1056:
1057:            /**
1058:             * sets the parent layer of this layer.
1059:             * 
1060:             * @param parent
1061:             */
1062:            public void setParent(Layer parent) {
1063:                this .parent = parent;
1064:            }
1065:
1066:            /**
1067:             * @return '0' if the layer is provided directly form the deegree WMS. other it returns the
1068:             *         number of cascaded WMS servers the is passed through
1069:             * 
1070:             */
1071:            public int getCascaded() {
1072:                return cascaded;
1073:            }
1074:
1075:            /**
1076:             * @return '0' if the WMS can resize map to arbitrary height. nonzero: map has a fixed height
1077:             *         that cannot be changed by the WMS.
1078:             * 
1079:             */
1080:            public int getFixedHeight() {
1081:                return fixedHeight;
1082:            }
1083:
1084:            /**
1085:             * @return '0' if the WMS can resize map to arbitrary width. nonzero: map has a fixed width that
1086:             *         cannot be changed by the WMS.
1087:             * 
1088:             */
1089:            public int getFixedWidth() {
1090:                return fixedWidth;
1091:            }
1092:
1093:            /**
1094:             * @return false if the WMS can map a subset of the full bounding box.
1095:             * 
1096:             */
1097:            public boolean hasNoSubsets() {
1098:                return noSubsets;
1099:            }
1100:
1101:            /**
1102:             * @return false if map data represents vector features that probably do not completely fill
1103:             *         space.
1104:             * 
1105:             */
1106:            public boolean isOpaque() {
1107:                return opaque;
1108:            }
1109:
1110:            /**
1111:             * @return true if the layer is queryable. That means it can be targeted by a GetFeatureInfo
1112:             *         request.
1113:             * 
1114:             */
1115:            public boolean isQueryable() {
1116:                return queryable;
1117:            }
1118:
1119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.