Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wmts / struct / WMTSLayer.java @ 34393

History | View | Annotate | Download (5.13 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22
package org.gvsig.remoteclient.wmts.struct;
23

    
24
import java.util.ArrayList;
25

    
26
import org.gvsig.remoteclient.wmts.WMTSServerDescription;
27

    
28
/**
29
 * Describes the attributes of a layer in a WMTS server
30
 *
31
 * @author Nacho Brodin (nachobrodin@gmail.com)
32
 */
33
public abstract class WMTSLayer extends WMTSBaseStruct {
34
        protected WMTSBoundingBox       wgs84bbox               = null;
35
        protected WMTSBoundingBox       bbox                    = null;
36
        //WMTSStyle
37
        private ArrayList               style                   = null;
38
        private ArrayList               imageFormat             = null;
39
        private ArrayList               infoFormat              = null;
40
        private WMTSDimension           dimension               = null;
41
        private String                  metadata                = null;
42
        //WMTSTileMatrixSetLink
43
        private ArrayList               tileMatrixSetLinkList   = null;
44
        private WMTSResourceURL         resourceURL             = null;
45
        protected WMTSServerDescription            status                  = null;
46
        
47
        public WMTSLayer(WMTSServerDescription status) {
48
                this.status = status;
49
        }
50
        
51
        public String getMetadata() {
52
                return metadata;
53
        }
54
        
55
        public void setMetadata(String metadata) {
56
                this.metadata = metadata;
57
        }
58
        
59
        public ArrayList getFormat() {
60
                if(imageFormat == null)
61
                        imageFormat = new ArrayList();
62
                return imageFormat;
63
        }
64
        
65
        public ArrayList getInfoFormat() {
66
                if(infoFormat == null)
67
                        infoFormat = new ArrayList();
68
                return infoFormat;
69
        }
70
        
71
        public abstract WMTSBoundingBox getWGS84BBox();
72
        
73
        public abstract WMTSBoundingBox getBBox();
74
        
75
        public WMTSResourceURL getResourceURL() {
76
                if(resourceURL == null)
77
                        resourceURL = (WMTSResourceURL)status.createVersionObject("WMTSResourceURL");
78
                return resourceURL;
79
        }
80

    
81
        public WMTSDimension getDimension() {
82
                if(dimension == null)
83
                        dimension = (WMTSDimension)status.createVersionObject("WMTSDimension");
84
                return dimension;
85
        }
86

    
87
        public ArrayList getStyle() {
88
                if(style == null)
89
                        style = new ArrayList();//(WMTSStyle)status.createVersionObject("WMTSStyle");
90
                return style;
91
        }
92

    
93
        public ArrayList getTileMatrixSetLink() {
94
                if(tileMatrixSetLinkList == null)
95
                        tileMatrixSetLinkList = new ArrayList();
96
                return tileMatrixSetLinkList;
97
        }
98
        
99
        /**
100
         * Links the TileMatrixSet with the limits inside the layer structure
101
         * @param tileMatrixSetList
102
         */
103
        public void linkTileMatrixSets(ArrayList tileMatrixSetList) {
104
                //Recorre la lista de TileMatrixSetLink y a cada uno le asigna su TileMatrixSet
105
                //Para cada TileMatrixLimits contenido en el TileMatrixSetLimits asociado le asigna
106
                //el objeto TileMatrix a partir de su referencia.
107
                if(tileMatrixSetLinkList == null)
108
                        return;
109
                for (int i = 0; i < tileMatrixSetLinkList.size(); i++) {
110
                        WMTSTileMatrixSetLink tileMatrixSetLink = (WMTSTileMatrixSetLink)tileMatrixSetLinkList.get(i);
111
                        String id = tileMatrixSetLink.getTileMatrixSetId();
112
                        for (int j = 0; j < tileMatrixSetList.size(); j++) {
113
                                WMTSTileMatrixSet tileMatrixSet = (WMTSTileMatrixSet)tileMatrixSetList.get(j);
114
                                if(tileMatrixSet.getIdentifier().compareTo(id) == 0) {
115
                                        tileMatrixSetLink.setTileMatrixSet(tileMatrixSet);
116
                                        tileMatrixSetLink.linkTileMatrix(tileMatrixSet);
117
                                        break;
118
                                }
119
                        }
120
                }
121
        }
122
        
123
        /**
124
         * Gets the list of srs's supported
125
         * @return
126
         */
127
        public ArrayList getSrsList() {
128
                ArrayList list = new ArrayList();
129
                for (int i = 0; i < tileMatrixSetLinkList.size(); i++) {
130
                        WMTSTileMatrixSetLink link = (WMTSTileMatrixSetLink)tileMatrixSetLinkList.get(i);
131
                        WMTSTileMatrixSet tileMatrixSet = link.getTileMatrixSet();
132
                        list.add(tileMatrixSet.getSupportedCRS());
133
                }
134
                return list;
135
        }
136
        
137
        public void print() {
138
                System.out.println("*****WMTSLayer******");
139
                System.out.println("Abstract:" + getAbstract());
140
                System.out.println("Identifier:" + getIdentifier());
141
                System.out.println("Keywords:" + getKeywords());
142
                System.out.println("Title:" + getTitle());
143
                for (int i = 0; i < getFormat().size(); i++) {
144
                        System.out.println("Format:" + getFormat().get(i));
145
                }
146
                for (int i = 0; i < getInfoFormat().size(); i++) {
147
                        System.out.println("InfoFormat:" + getInfoFormat().get(i));
148
                }
149
                getBBox().print();
150
                getWGS84BBox().print();
151
                getDimension().print();
152
                System.out.println("Metadata:" + getMetadata());
153
                for (int i = 0; i < getTileMatrixSetLink().size(); i++) {
154
                        ((WMTSTileMatrixSetLink)getTileMatrixSetLink().get(i)).print();
155
                }
156
        }
157

    
158
}