Revision 37802

View differences:

branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/wmts/wmts_1_0_0/struct/WMTSLayer_1_0_0.java
66 66
					} else if (compareName(parser, CapabilitiesTags.WMTS_ABSTRACT)) {
67 67
						setAbstract(nextText(parser)); 
68 68
					} else if (compareName(parser, CapabilitiesTags.WMTS_KEYWORDS)) {
69
						setKeywords(nextText(parser)); 
69
						WMTSKeywords_1_0_0 keywords = new WMTSKeywords_1_0_0();
70
						keywords.parse(parser);
71
						setKeywords(keywords.getKeywords());
70 72
					} else if (compareName(parser, CapabilitiesTags.WMTS_BOUNDINGBOX)) {
71 73
						getBBox().parse(parser);  
72 74
					} else if (compareName(parser, CapabilitiesTags.WMTS_STYLE)) {
branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/wmts/wmts_1_0_0/struct/WMTSTileMatrixSet_1_0_0.java
54 54
					} else if (compareName(parser, CapabilitiesTags.WMTS_ABSTRACT)) {
55 55
						setAbstract(nextText(parser));
56 56
					} else if (compareName(parser, CapabilitiesTags.WMTS_KEYWORDS)) {
57
						setKeywords(nextText(parser));
57
						parser.skipSubTree();
58 58
					} else if (compareName(parser, CapabilitiesTags.WMTS_BOUNDINGBOX)) {
59 59
						getBoundingBox().parse(parser);
60 60
					} else if (compareName(parser, CapabilitiesTags.WMTS_SUPPORTEDCRS)) {
branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/wmts/wmts_1_0_0/struct/WMTSKeywords_1_0_0.java
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.wmts_1_0_0.struct;
23

  
24
import java.io.IOException;
25
import java.util.ArrayList;
26

  
27
import org.gvsig.remoteclient.utils.CapabilitiesTags;
28
import org.gvsig.remoteclient.wmts.struct.WMTSBaseStruct;
29
import org.kxml2.io.KXmlParser;
30
import org.xmlpull.v1.XmlPullParserException;
31

  
32
/**
33
 * <p>Keywords for a WMTS Layer</p>
34
 *
35
 * @author Nacho Brodin (nachobrodin@gmail.com)
36
 */
37
public class WMTSKeywords_1_0_0 extends WMTSBaseStruct {
38
	private ArrayList    keywords            = null;
39
	
40
	public ArrayList getKeywords() {
41
		return keywords;
42
	}
43

  
44
	public void addKeyword(String k) {
45
		if(keywords == null)
46
			keywords = new ArrayList();
47
		keywords.add(k);
48
	}
49
	
50
	/**
51
     * Parses the layer's style
52
     * @param parser
53
     * @param style
54
     * @throws IOException
55
     * @throws XmlPullParserException
56
     */
57
    public void parse(KXmlParser parser) throws IOException, XmlPullParserException {
58
    	int currentTag;
59
    	boolean end = false;
60
    	
61
    	currentTag = parser.next();
62
    	
63
    	while (!end) {
64
			 switch(currentTag) {
65
				case KXmlParser.START_TAG:
66
					if (compareName(parser, CapabilitiesTags.WMTS_KEYWORD)) {
67
						addKeyword(nextText(parser));
68
					}
69
					break;
70
				case KXmlParser.END_TAG:
71
					if (compareName(parser, CapabilitiesTags.WMTS_KEYWORDS))
72
						end = true;
73
					break;
74
				case KXmlParser.TEXT:					
75
				break;
76
			 }
77
             if (!end)
78
                 currentTag = parser.next();
79
    	}
80
    }
81
}
0 82

  
branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/wmts/struct/WMTSLayer.java
37 37
	private ArrayList               style                        = null;
38 38
	private ArrayList               imageFormat                  = null;
39 39
	private ArrayList               infoFormat                   = null;
40
	private ArrayList               keywords                     = null;
40 41
	private WMTSDimension           dimension                    = null;
41 42
	private String                  metadata                     = null;
42 43
	//WMTSTileMatrixSetLink
......
77 78
		return infoFormat;
78 79
	}
79 80
	
81
	public ArrayList getKeywords() {
82
		return keywords;
83
	}
84
	
85
	public void setKeywords(ArrayList k) {
86
		this.keywords = k;
87
	}
88
	
80 89
	public abstract WMTSBoundingBox getWGS84BBox();
81 90
	
82 91
	public abstract WMTSBoundingBox getBBox();
......
106 115
	}
107 116
	
108 117
	/**
118
	 * Returns the initial level of this layer inside the matrix set. 
119
	 * @return
120
	 */
121
	public int getInitialLevel(String tileMatrixSetId) {
122
		int initialLevel = 0;
123
		for (int i = 0; i < tileMatrixSetLinkList.size(); i++) {
124
			WMTSTileMatrixSetLink tileMatrixSetLink = (WMTSTileMatrixSetLink)tileMatrixSetLinkList.get(i);
125
			String id = tileMatrixSetLink.getTileMatrixSetId();
126
			if(tileMatrixSetId.compareTo(id) == 0) {
127
				ArrayList tileMatrixLimits = tileMatrixSetLink.getTileMatrixLimits();
128
				if(tileMatrixLimits != null && tileMatrixLimits.size() > 0) {
129
					String ref = ((WMTSTileMatrixLimits)tileMatrixLimits.get(0)).getRefToTileMatrix();
130
					ArrayList tileMatrixList = tileMatrixSetLink.getTileMatrixSet().getTileMatrix();
131
					for (int j = 0; j < tileMatrixList.size(); j++) {
132
						String idTileMatrix = ((WMTSTileMatrix)tileMatrixList.get(j)).getIdentifier();
133
						if(idTileMatrix.compareTo(ref) == 0)
134
							return initialLevel;
135
						initialLevel ++;
136
					}
137
				}
138
			}
139
		}
140
		return initialLevel;
141
	}
142
	
143
	/**
109 144
	 * Links the TileMatrixSet with the limits inside the layer structure
110 145
	 * @param tileMatrixSetList
111 146
	 */
......
147 182
		System.out.println("*****WMTSLayer******");
148 183
		System.out.println("Abstract:" + getAbstract());
149 184
		System.out.println("Identifier:" + getIdentifier());
150
		System.out.println("Keywords:" + getKeywords());
185
		System.out.println("Keywords:");
186
		for (int i = 0; i < keywords.size(); i++) {
187
			System.out.println("Keyword:" + keywords.get(i));
188
		}
151 189
		System.out.println("Title:" + getTitle());
152 190
		for (int i = 0; i < getFormat().size(); i++) {
153 191
			System.out.println("Format:" + getFormat().get(i));
branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/wmts/struct/WMTSBaseStruct.java
32 32
 * @author Nacho Brodin (nachobrodin@gmail.com)
33 33
 */
34 34
public abstract class WMTSBaseStruct {
35
	public  static String   gmlTag              = CapabilitiesTags.WMTS_GMLTAG;
36
	private String          identifier          = null;
37
	private String          title               = null;
38
    private String          abstractObj         = null;
39
    private String          keywords            = null;
35
	public  static String        gmlTag              = CapabilitiesTags.WMTS_GMLTAG;
36
	private String               identifier          = null;
37
	private String               title               = null;
38
    private String               abstractObj         = null;
40 39
    
41 40
    /**
42 41
     * Parses this service ID
......
72 71
		this.abstractObj = abstr;
73 72
	}
74 73

  
75
	public String getKeywords() {
76
		return keywords;
77
	}
78

  
79
	public void setKeywords(String keywords) {
80
		this.keywords = keywords;
81
	}
82
	
83 74
    /**
84 75
     * Compares the next name in the selected parser with the string passed
85 76
     * by value.
branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/utils/CapabilitiesTags.java
215 215
	public final static String WMTS_TITLE = "Title";
216 216
	public final static String WMTS_ABSTRACT = "Abstract";
217 217
	public final static String WMTS_KEYWORDS = "Keywords";
218
	public final static String WMTS_KEYWORD = "Keyword";
218 219
	public final static String WMTS_LEGENDURL = "LegendURL";
219 220
	public final static String WMTS_ISDEFAULT = "isDefault";
220 221
	//Layer

Also available in: Unified diff