root / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wmts / struct / WMTSTileMatrixSetLink.java @ 38531
History | View | Annotate | Download (3.44 KB)
1 | 34236 | nbrodin | /* 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.io.IOException; |
||
25 | import java.util.ArrayList; |
||
26 | |||
27 | import org.kxml2.io.KXmlParser; |
||
28 | import org.xmlpull.v1.XmlPullParserException; |
||
29 | |||
30 | /**
|
||
31 | * Set of tiles
|
||
32 | * @author Nacho Brodin (nachobrodin@gmail.com)
|
||
33 | */
|
||
34 | public abstract class WMTSTileMatrixSetLink { |
||
35 | 35469 | nbrodin | private String tileMatrixSetId = null; |
36 | private WMTSTileMatrixSet tileMatrixSet = null; |
||
37 | private ArrayList tileMatrixLimits = null; |
||
38 | protected boolean forceLongitudeFirstAxisOrder = false; |
||
39 | 34236 | nbrodin | |
40 | 35469 | nbrodin | /**
|
41 | * Sets longitude first in the axis order read from the capabilities file
|
||
42 | * @param force
|
||
43 | */
|
||
44 | public void setForceLongitudeFirstAxisOrder(boolean force) { |
||
45 | this.forceLongitudeFirstAxisOrder = force;
|
||
46 | } |
||
47 | |||
48 | 34236 | nbrodin | /**
|
49 | * Parses this service
|
||
50 | * @param parser
|
||
51 | * @param content
|
||
52 | * @throws IOException
|
||
53 | * @throws XmlPullParserException
|
||
54 | */
|
||
55 | public abstract void parse(KXmlParser parser) throws IOException, XmlPullParserException; |
||
56 | |||
57 | 34260 | nbrodin | public String getTileMatrixSetId() { |
58 | return tileMatrixSetId;
|
||
59 | } |
||
60 | |||
61 | public void setTileMatrixSetId(String tileMatrixSetId) { |
||
62 | this.tileMatrixSetId = tileMatrixSetId;
|
||
63 | } |
||
64 | |||
65 | public WMTSTileMatrixSet getTileMatrixSet() {
|
||
66 | 34236 | nbrodin | return tileMatrixSet;
|
67 | } |
||
68 | |||
69 | 34260 | nbrodin | public void setTileMatrixSet(WMTSTileMatrixSet tileMatrixSet) { |
70 | 34236 | nbrodin | this.tileMatrixSet = tileMatrixSet;
|
71 | } |
||
72 | |||
73 | public ArrayList getTileMatrixLimits() { |
||
74 | if(tileMatrixLimits == null) |
||
75 | tileMatrixLimits = new ArrayList(); |
||
76 | return tileMatrixLimits;
|
||
77 | } |
||
78 | |||
79 | 34260 | nbrodin | /**
|
80 | * Links the TileMatrixLimits with the TileMatrix
|
||
81 | * @param tileMatrixSet
|
||
82 | */
|
||
83 | public void linkTileMatrix(WMTSTileMatrixSet tileMatrixSet) { |
||
84 | //Recorre la lista de TileMatrixLimits y asigna a cada uno el TileMatrix asociado
|
||
85 | //definido en la etiqueta
|
||
86 | if(tileMatrixLimits == null) |
||
87 | return;
|
||
88 | for (int i = 0; i < tileMatrixLimits.size(); i++) { |
||
89 | WMTSTileMatrixLimits limits = (WMTSTileMatrixLimits)tileMatrixLimits.get(i); |
||
90 | String id = limits.getRefToTileMatrix();
|
||
91 | for (int j = 0; j < tileMatrixSet.getTileMatrix().size(); j++) { |
||
92 | WMTSTileMatrix tileMatrix = (WMTSTileMatrix)tileMatrixSet.getTileMatrix().get(j); |
||
93 | if(tileMatrix.getIdentifier().compareTo(id) == 0) { |
||
94 | limits.setTileMatrix(tileMatrix); |
||
95 | break;
|
||
96 | } |
||
97 | } |
||
98 | } |
||
99 | } |
||
100 | |||
101 | 34236 | nbrodin | public void print() { |
102 | 34260 | nbrodin | System.out.println(" *****WMTSTileMatrixSetLink******"); |
103 | System.out.println("TileMatrixSet ID:" + getTileMatrixSetId()); |
||
104 | 34236 | nbrodin | for (int i = 0; i < getTileMatrixLimits().size(); i++) { |
105 | WMTSTileMatrixLimits limits = ((WMTSTileMatrixLimits)getTileMatrixLimits().get(i)); |
||
106 | limits.print(); |
||
107 | } |
||
108 | } |
||
109 | } |