Revision 1809
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSStyle.java | ||
---|---|---|
1 |
package org.gvsig.raster.wmts.ogc.struct; |
|
2 |
|
|
3 |
|
|
4 |
public interface WMTSStyle { |
|
5 |
public WMTSLegendURL getLegendURL(); |
|
6 |
|
|
7 |
public boolean isDefault(); |
|
8 |
|
|
9 |
public String toString(); |
|
10 |
} |
|
0 | 11 |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSLegendURL.java | ||
---|---|---|
1 |
package org.gvsig.raster.wmts.ogc.struct; |
|
2 |
|
|
3 |
public interface WMTSLegendURL { |
|
4 |
|
|
5 |
public int getWidth(); |
|
6 |
|
|
7 |
public int getHeight(); |
|
8 |
|
|
9 |
public double getMinScaleDenominator(); |
|
10 |
|
|
11 |
public double getMaxScaleDenominator(); |
|
12 |
|
|
13 |
public String getFormat(); |
|
14 |
|
|
15 |
public String getHref(); |
|
16 |
} |
|
0 | 17 |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSTheme.java | ||
---|---|---|
1 |
package org.gvsig.raster.wmts.ogc.struct; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
public interface WMTSTheme { |
|
6 |
public WMTSLayer getLayer(); |
|
7 |
|
|
8 |
public List<WMTSTheme> getThemeList(); |
|
9 |
|
|
10 |
public List<String> getLayerRef(); |
|
11 |
|
|
12 |
/** |
|
13 |
* Gets a node by its name |
|
14 |
* @param name |
|
15 |
* @return |
|
16 |
*/ |
|
17 |
public WMTSTheme getNodeByName(String name); |
|
18 |
|
|
19 |
/** |
|
20 |
* Gets the number of nodes |
|
21 |
* @param parent |
|
22 |
* @return |
|
23 |
*/ |
|
24 |
public int getChildCount(); |
|
25 |
|
|
26 |
/** |
|
27 |
* Gets the children of the index position |
|
28 |
* @param index |
|
29 |
* @return |
|
30 |
*/ |
|
31 |
public WMTSTheme getChildren(int index); |
|
32 |
|
|
33 |
/** |
|
34 |
* Gets the index of a children |
|
35 |
* @param parent |
|
36 |
* @param child |
|
37 |
* @return |
|
38 |
*/ |
|
39 |
public int getIndexOfChild(WMTSTheme child); |
|
40 |
|
|
41 |
public String toString(); |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSTileMatrix.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.awt.geom.Point2D; |
4 | 4 |
import java.awt.geom.Rectangle2D; |
5 |
import java.util.ArrayList;
|
|
5 |
import java.util.List; |
|
6 | 6 |
|
7 | 7 |
public interface WMTSTileMatrix { |
8 | 8 |
/** |
... | ... | |
11 | 11 |
*/ |
12 | 12 |
public void setForceLongitudeFirstAxisOrder(boolean force); |
13 | 13 |
|
14 |
public void setBBoxTileMatrixSet(Rectangle2D bbox); |
|
15 |
|
|
16 | 14 |
public Rectangle2D getBBoxTileMatrixSet(); |
17 | 15 |
|
18 | 16 |
public double getScaleDenominator(); |
... | ... | |
44 | 42 |
* intersects then this will be added to the list. |
45 | 43 |
* @deprecated this method was for grid subsets. |
46 | 44 |
*/ |
47 |
public ArrayList intersects(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Rectangle2D request, Rectangle2D extentLayer);
|
|
45 |
public List<WMTSTile> intersects(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Rectangle2D request, Rectangle2D extentLayer);
|
|
48 | 46 |
|
49 | 47 |
/** |
50 | 48 |
* This function will check if the request coordinates intersects with the tiles in the matrix. If a tile |
51 | 49 |
* intersects then this will be added to the list. |
52 | 50 |
*/ |
53 |
public ArrayList intersects(boolean projected, Rectangle2D request, Rectangle2D extentLayer);
|
|
51 |
public List<WMTSTile> intersects(boolean projected, Rectangle2D request, Rectangle2D extentLayer);
|
|
54 | 52 |
|
55 | 53 |
|
56 | 54 |
/** |
57 | 55 |
* This function will check if the request coordinates intersects with the tiles in the matrix. If a tile |
58 | 56 |
* intersects then this will be added to the list. |
59 | 57 |
*/ |
60 |
public ArrayList contains(boolean projected, Point2D point, Rectangle2D extentLayer);
|
|
58 |
public List<WMTSTile> contains(boolean projected, Point2D point, Rectangle2D extentLayer);
|
|
61 | 59 |
|
62 | 60 |
/** |
63 | 61 |
* This function will check if the request coordinates intersects with the tiles in the matrix. If a tile |
64 | 62 |
* intersects then this will be added to the list. |
65 | 63 |
*/ |
66 |
public ArrayList contains(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Point2D point, Rectangle2D extentLayer);
|
|
64 |
public List<WMTSTile> contains(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Point2D point, Rectangle2D extentLayer);
|
|
67 | 65 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSThemes.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.wmts.ogc.struct; |
2 | 2 |
|
3 |
|
|
3 | 4 |
public interface WMTSThemes { |
4 |
|
|
5 |
/** |
|
6 |
* Gets a node by its name |
|
7 |
* @param name |
|
8 |
* @return |
|
9 |
*/ |
|
10 |
public WMTSTheme getNodeByName(String name); |
|
11 |
|
|
12 |
/** |
|
13 |
* Gets the number of nodes |
|
14 |
* @param parent |
|
15 |
* @return |
|
16 |
*/ |
|
17 |
public int getChildCount(); |
|
18 |
|
|
19 |
/** |
|
20 |
* Gets the children of the index position |
|
21 |
* @param index |
|
22 |
* @return |
|
23 |
*/ |
|
24 |
public WMTSTheme getChildren(int index); |
|
25 |
|
|
26 |
/** |
|
27 |
* Gets the index of a children |
|
28 |
* @param parent |
|
29 |
* @param child |
|
30 |
* @return |
|
31 |
*/ |
|
32 |
public int getIndexOfChild(WMTSTheme child); |
|
33 |
|
|
34 |
public String toString(); |
|
5 | 35 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSServiceIdentification.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.wmts.ogc.struct; |
2 | 2 |
|
3 | 3 |
public interface WMTSServiceIdentification { |
4 |
|
|
5 |
public String getServiceType(); |
|
6 |
|
|
7 |
public String getServiceTypeVersion(); |
|
4 | 8 |
|
9 |
public String getProfile(); |
|
10 |
|
|
11 |
public String getFees(); |
|
12 |
|
|
13 |
public String getAccessConstraints(); |
|
5 | 14 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSServiceProvider.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.wmts.ogc.struct; |
2 | 2 |
|
3 | 3 |
public interface WMTSServiceProvider { |
4 |
|
|
5 |
public String getProviderName(); |
|
6 |
|
|
7 |
public String getProviderSite(); |
|
4 | 8 |
|
9 |
public String getServiceContact(); |
|
5 | 10 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSLayer.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.wmts.ogc.struct; |
2 | 2 |
|
3 |
import java.util.List; |
|
3 | 4 |
|
5 |
|
|
4 | 6 |
public interface WMTSLayer { |
5 | 7 |
public WMTSBoundingBox getWGS84BBox(); |
8 |
|
|
9 |
public String getMetadata(); |
|
10 |
|
|
11 |
public List<String> getFormat(); |
|
12 |
|
|
13 |
public List<String> getInfoFormat(); |
|
14 |
|
|
15 |
public List<String> getKeywords(); |
|
16 |
|
|
17 |
public abstract WMTSBoundingBox getBBox(); |
|
18 |
|
|
19 |
public List<WMTSStyle> getStyle(); |
|
20 |
|
|
21 |
public List<WMTSTileMatrixSetLink> getTileMatrixSetLink(); |
|
22 |
|
|
23 |
/** |
|
24 |
* Returns the initial level of this layer inside the matrix set. |
|
25 |
* @return |
|
26 |
*/ |
|
27 |
public int getInitialLevel(String tileMatrixSetId); |
|
28 |
|
|
29 |
/** |
|
30 |
* Gets the list of srs's supported |
|
31 |
* @return |
|
32 |
*/ |
|
33 |
public List<String> getSrsList(); |
|
6 | 34 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSTileMatrixSetLink.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.wmts.ogc.struct; |
2 | 2 |
|
3 |
import java.util.List; |
|
3 | 4 |
|
5 |
|
|
4 | 6 |
public interface WMTSTileMatrixSetLink { |
7 |
/** |
|
8 |
* Gets the <code>WMTSTileMatrixSet</code> |
|
9 |
* @return |
|
10 |
*/ |
|
5 | 11 |
public WMTSTileMatrixSet getTileMatrixSet(); |
12 |
|
|
13 |
/** |
|
14 |
* Gets the list of limits of this <code>WMTSTileMatrixSetLink</code> |
|
15 |
* @return |
|
16 |
*/ |
|
17 |
public List<WMTSTileMatrixLimits> getTileMatrixLimits(); |
|
18 |
|
|
19 |
public String getTileMatrixSetId(); |
|
6 | 20 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSTile.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.wmts.ogc.struct; |
2 | 2 |
|
3 |
import java.awt.geom.Point2D; |
|
4 |
|
|
3 | 5 |
public interface WMTSTile { |
4 |
|
|
6 |
|
|
7 |
public Point2D worldToRaster(Point2D pt); |
|
8 |
|
|
9 |
public WMTSTile cloneTile(); |
|
5 | 10 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSBoundingBox.java | ||
---|---|---|
3 | 3 |
import java.awt.geom.Rectangle2D; |
4 | 4 |
|
5 | 5 |
public interface WMTSBoundingBox { |
6 |
|
|
6 | 7 |
public Rectangle2D toRectangle2D(); |
8 |
|
|
9 |
public double[] getLowerCorner(); |
|
10 |
|
|
11 |
public double[] getUpperCorner(); |
|
12 |
|
|
13 |
public String getCrs(); |
|
14 |
|
|
15 |
public int getDimensions(); |
|
16 |
|
|
17 |
public boolean isValid(); |
|
7 | 18 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/struct/WMTSTileMatrixSet.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.wmts.ogc.struct; |
2 | 2 |
|
3 |
import java.util.List; |
|
4 |
|
|
3 | 5 |
public interface WMTSTileMatrixSet { |
6 |
|
|
7 |
public WMTSBoundingBox getBoundingBox(); |
|
8 |
|
|
9 |
public String getWellKnownScaleSet(); |
|
10 |
|
|
11 |
public List<WMTSTileMatrix> getTileMatrix(); |
|
4 | 12 |
|
13 |
public String getSupportedCRS(); |
|
5 | 14 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/exception/WMTSException.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.raster.wmts.ogc.exception; |
23 | 23 |
|
24 |
import java.util.Hashtable; |
|
25 |
import java.util.Map; |
|
26 | 24 |
|
27 | 25 |
/** |
28 | 26 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
... | ... | |
61 | 59 |
formatString = message; |
62 | 60 |
} |
63 | 61 |
|
64 |
protected Map values() { |
|
65 |
Hashtable params; |
|
66 |
params = new Hashtable(); |
|
67 |
return params; |
|
68 |
} |
|
69 |
|
|
70 | 62 |
public void init() { |
71 | 63 |
messageKey = "wmts_exception"; |
72 | 64 |
formatString = "WMTS Exception"; |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.api/src/main/java/org/gvsig/raster/wmts/ogc/exception/DownloadException.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.raster.wmts.ogc.exception; |
23 | 23 |
|
24 |
import java.util.Hashtable; |
|
25 |
import java.util.Map; |
|
26 | 24 |
|
27 | 25 |
/** |
28 | 26 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
... | ... | |
60 | 58 |
formatString = message; |
61 | 59 |
} |
62 | 60 |
|
63 |
protected Map values() { |
|
64 |
Hashtable params; |
|
65 |
params = new Hashtable(); |
|
66 |
return params; |
|
67 |
} |
|
68 |
|
|
69 | 61 |
public void init() { |
70 | 62 |
messageKey = "wmts_exception"; |
71 | 63 |
formatString = "WMTS Exception"; |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/base/WMTSStatusImpl.java | ||
---|---|---|
27 | 27 |
import org.gvsig.raster.wmts.ogc.WMTSStatus; |
28 | 28 |
import org.gvsig.raster.wmts.ogc.impl.Tags; |
29 | 29 |
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSTileMatrixImpl.InternalTileImpl; |
30 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTile; |
|
30 | 31 |
|
31 | 32 |
/** |
32 | 33 |
* Describes the status of a WMTSclient, so it adds to the Remote client status |
... | ... | |
52 | 53 |
private String tileMatrix = null; |
53 | 54 |
private int tileCol = -1; |
54 | 55 |
private int tileRow = -1; |
55 |
private List<InternalTileImpl> tileList = null;
|
|
56 |
private List<WMTSTile> tileList = null;
|
|
56 | 57 |
private String infoFormat = null; |
57 | 58 |
private int level = -1; |
58 | 59 |
|
... | ... | |
157 | 158 |
this.tileRow = tileRow; |
158 | 159 |
} |
159 | 160 |
|
160 |
public List<InternalTileImpl> getTileList() {
|
|
161 |
public List<WMTSTile> getTileList() {
|
|
161 | 162 |
return tileList; |
162 | 163 |
} |
163 | 164 |
|
164 |
public void setTileList(List<InternalTileImpl> tileList) {
|
|
165 |
public void setTileList(List<WMTSTile> tileList) {
|
|
165 | 166 |
this.tileList = tileList; |
166 | 167 |
} |
167 | 168 |
|
... | ... | |
189 | 190 |
status.tileMatrix = tileMatrix; |
190 | 191 |
status.tileCol = tileCol; |
191 | 192 |
status.tileRow = tileRow; |
192 |
status.tileList = new ArrayList<InternalTileImpl>();
|
|
193 |
status.tileList = new ArrayList<WMTSTile>();
|
|
193 | 194 |
for (int i = 0; i < tileList.size(); i++) { |
194 |
InternalTileImpl t = ((InternalTileImpl)tileList.get(i)).cloneTile();
|
|
195 |
WMTSTile t = ((InternalTileImpl)tileList.get(i)).cloneTile();
|
|
195 | 196 |
status.tileList.add(t); |
196 | 197 |
} |
197 | 198 |
status.infoFormat = infoFormat; |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/base/WMTSServiceInformation.java | ||
---|---|---|
43 | 43 |
*/ |
44 | 44 |
public class WMTSServiceInformation { |
45 | 45 |
public String online_resource = null; |
46 |
protected HashMap operationsGet = new HashMap(); |
|
47 |
protected HashMap operationsPost = new HashMap(); |
|
46 |
protected HashMap<String, WMTSOperation> |
|
47 |
operationsGet = new HashMap<String, WMTSOperation>(); |
|
48 |
protected HashMap<String, WMTSOperation> |
|
49 |
operationsPost = new HashMap<String, WMTSOperation>(); |
|
48 | 50 |
public String version; |
49 | 51 |
public String name; |
50 | 52 |
public String scope; |
... | ... | |
65 | 67 |
public String phone; |
66 | 68 |
public String fax; |
67 | 69 |
public String email; |
68 |
public Vector formats; |
|
70 |
public Vector<String> |
|
71 |
formats; |
|
69 | 72 |
|
70 | 73 |
public WMTSServiceInformation() { |
71 | 74 |
version = new String(); |
... | ... | |
88 | 91 |
phone = new String(); |
89 | 92 |
fax = new String(); |
90 | 93 |
email = new String(); |
91 |
formats = new Vector(); |
|
94 |
formats = new Vector<String>();
|
|
92 | 95 |
} |
93 | 96 |
|
94 | 97 |
/** |
... | ... | |
170 | 173 |
* Get a hash map with the supported operations |
171 | 174 |
* @return |
172 | 175 |
*/ |
173 |
public Hashtable getSupportedOperationsByName(){ |
|
174 |
Hashtable operations = new Hashtable();
|
|
175 |
Iterator getIt = operationsGet.keySet().iterator(); |
|
176 |
public Hashtable<String, String> getSupportedOperationsByName(){
|
|
177 |
Hashtable<String, String> operations = new Hashtable<String, String>();
|
|
178 |
Iterator<String> getIt = operationsGet.keySet().iterator();
|
|
176 | 179 |
while (getIt.hasNext()){ |
177 | 180 |
String id = (String)getIt.next(); |
178 | 181 |
WMTSOperation operation = (WMTSOperation)operationsGet.get(id); |
... | ... | |
227 | 230 |
phone = new String(); |
228 | 231 |
fax = new String(); |
229 | 232 |
email = new String(); |
230 |
formats = new Vector(); |
|
233 |
formats = new Vector<String>();
|
|
231 | 234 |
} |
232 | 235 |
|
233 | 236 |
/* (non-Javadoc) |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/base/WMTSProtocolHandlerFactory.java | ||
---|---|---|
27 | 27 |
import java.net.ConnectException; |
28 | 28 |
import java.net.URL; |
29 | 29 |
import java.util.ArrayList; |
30 |
import java.util.Iterator;
|
|
30 |
import java.util.List;
|
|
31 | 31 |
|
32 | 32 |
import org.gvsig.raster.wmts.ogc.impl.Tags; |
33 | 33 |
import org.kxml2.io.KXmlParser; |
... | ... | |
42 | 42 |
*/ |
43 | 43 |
public class WMTSProtocolHandlerFactory { |
44 | 44 |
|
45 |
private static ArrayList supportedVersions = new ArrayList();
|
|
45 |
private static List<String> supportedVersions = new ArrayList<String>();
|
|
46 | 46 |
|
47 | 47 |
static { |
48 | 48 |
supportedVersions.add("1.0.0"); |
49 | 49 |
} |
50 | 50 |
|
51 |
/** |
|
52 |
* M?todo que dada una respuesta de getCapabilities y un iterador sobre una |
|
53 |
* coleccion de WMSClient's ordenada descendentemente devuelve el cliente |
|
54 |
* cuya version es igual o inmediatamente inferior |
|
55 |
* |
|
56 |
* @param caps Capabilities con la respuesta del servidor |
|
57 |
* @param clients Iterador de conjunto ordenado descendientemente |
|
58 |
* |
|
59 |
* @return cliente cuya version es igual o inmediatamente inferior |
|
60 |
* @throws IllegalAccessException |
|
61 |
* @throws InstantiationException |
|
62 |
* |
|
63 |
*/ |
|
64 |
private static String getDriverVersion(String version, Iterator clients) throws InstantiationException, IllegalAccessException { |
|
65 |
while (clients.hasNext()) { |
|
66 |
String clientVersion = (String)clients.next(); |
|
67 |
int ret = version.compareTo(clientVersion); |
|
68 |
|
|
69 |
if (ret >= 0) { |
|
70 |
return clientVersion; |
|
71 |
} |
|
72 |
} |
|
73 |
return null; |
|
74 |
} |
|
75 |
|
|
76 | 51 |
/** |
77 | 52 |
* Establece la versi?n con la que se comunicar? con el servidor y devuelve |
78 | 53 |
* el objeto Capabilities obtenido con dicha versi?n |
... | ... | |
160 | 135 |
*/ |
161 | 136 |
private static WMTSProtocolHandler createVersionDriver(String version) { |
162 | 137 |
try { |
163 |
Class driver; |
|
138 |
Class<?> driver;
|
|
164 | 139 |
version = version.replace('.', '_'); |
165 | 140 |
driver = Class.forName("org.gvsig.raster.wmts.ogc.impl.wmts_" + version + ".WMTSProtocolHandler" + version); |
166 | 141 |
return (WMTSProtocolHandler)driver.newInstance(); |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/base/WMTSServerDescription.java | ||
---|---|---|
24 | 24 |
import java.lang.reflect.Constructor; |
25 | 25 |
import java.lang.reflect.InvocationTargetException; |
26 | 26 |
import java.util.ArrayList; |
27 |
import java.util.List; |
|
27 | 28 |
|
28 | 29 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException; |
29 | 30 |
import org.gvsig.raster.wmts.ogc.impl.Tags; |
... | ... | |
31 | 32 |
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSServiceIdentificationImpl; |
32 | 33 |
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSServiceProviderImpl; |
33 | 34 |
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSThemesImpl; |
35 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer; |
|
36 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSet; |
|
34 | 37 |
|
35 | 38 |
|
36 | 39 |
/** |
... | ... | |
41 | 44 |
*/ |
42 | 45 |
public class WMTSServerDescription { |
43 | 46 |
// width and heigh of the map |
44 |
private int width; |
|
45 |
private int height; |
|
46 |
|
|
47 |
private int width; |
|
48 |
private int height; |
|
47 | 49 |
//format of the image to be retrieved |
48 |
private String format; |
|
49 |
private String infoFormat; |
|
50 |
private String format;
|
|
51 |
private String infoFormat;
|
|
50 | 52 |
// spatial reference system of the image to be retrieved |
51 |
private String srs; |
|
53 |
private String srs;
|
|
52 | 54 |
// exception format, to be retrieved in case of error |
53 |
private String exceptionFormat; |
|
54 |
|
|
55 |
private String exceptionFormat; |
|
55 | 56 |
//To set if the client has to use GET or POST |
56 |
private int protocol = Tags.PROTOCOL_UNDEFINED;
|
|
57 |
private ArrayList layerList = null;
|
|
58 |
private ArrayList tileMatrixSet = null;
|
|
57 |
private int protocol = Tags.PROTOCOL_UNDEFINED;
|
|
58 |
private List<WMTSLayer> layerList = null;
|
|
59 |
private List<WMTSTileMatrixSet> tileMatrixSet = null;
|
|
59 | 60 |
private WMTSThemesImpl themes = null; |
60 | 61 |
private WMTSServiceIdentificationImpl serviceId = null; |
61 | 62 |
private WMTSServiceProviderImpl serviceProv = null; |
62 |
private String version = null; |
|
63 |
private String version = null;
|
|
63 | 64 |
|
64 | 65 |
public WMTSServerDescription(String version) { |
65 | 66 |
this.version = version; |
... | ... | |
124 | 125 |
* Builds a new layer using the version number |
125 | 126 |
* @return |
126 | 127 |
*/ |
128 |
@SuppressWarnings("unchecked") |
|
127 | 129 |
public WMTSLayerImpl buildNewLayer() { |
128 | 130 |
try { |
129 | 131 |
Class clase; |
... | ... | |
172 | 174 |
*/ |
173 | 175 |
public Object createVersionObject(String className, String version) { |
174 | 176 |
try { |
175 |
Class driver; |
|
177 |
Class<?> driver;
|
|
176 | 178 |
version = version.replace('.', '_'); |
177 | 179 |
driver = Class.forName("org.gvsig.raster.wmts.ogc.impl.wmts_" + version + ".struct." + className + "_" + version); |
178 | 180 |
return driver.newInstance(); |
... | ... | |
206 | 208 |
/** |
207 | 209 |
* Gets the list of WMTSLayer |
208 | 210 |
*/ |
209 |
public ArrayList getLayerList() {
|
|
211 |
public List<WMTSLayer> getLayerList() {
|
|
210 | 212 |
if(layerList == null) |
211 |
layerList = new ArrayList(); |
|
213 |
layerList = new ArrayList<WMTSLayer>();
|
|
212 | 214 |
return layerList; |
213 | 215 |
} |
214 | 216 |
|
... | ... | |
216 | 218 |
* Gets the list of WMTSTileMatrixSet |
217 | 219 |
* @return |
218 | 220 |
*/ |
219 |
public ArrayList getTileMatrixSet() {
|
|
221 |
public List<WMTSTileMatrixSet> getTileMatrixSet() {
|
|
220 | 222 |
if(tileMatrixSet == null) |
221 |
tileMatrixSet = new ArrayList(); |
|
223 |
tileMatrixSet = new ArrayList<WMTSTileMatrixSet>();
|
|
222 | 224 |
return tileMatrixSet; |
223 | 225 |
} |
224 | 226 |
|
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/base/WMTSProtocolHandler.java | ||
---|---|---|
310 | 310 |
//************************************************************** |
311 | 311 |
//Esto es temporal hasta que est? la cach? |
312 | 312 |
|
313 |
private Hashtable downloadedFiles; |
|
313 |
private Hashtable<URL, String> downloadedFiles;
|
|
314 | 314 |
/** |
315 | 315 |
* Returns the content of a URL as a file from the file system.<br> |
316 | 316 |
* <p> |
... | ... | |
343 | 343 |
*/ |
344 | 344 |
void addDownloadedURL(URL url, String filePath) { |
345 | 345 |
if (downloadedFiles == null) |
346 |
downloadedFiles = new Hashtable(); |
|
347 |
String fileName = (String) downloadedFiles.put(url, filePath);
|
|
346 |
downloadedFiles = new Hashtable<URL, String>();
|
|
347 |
downloadedFiles.put(url, filePath); |
|
348 | 348 |
} |
349 | 349 |
|
350 | 350 |
//Fin del c?digo temporal hasta que est? la cach? |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/base/WMTSClientImpl.java | ||
---|---|---|
26 | 26 |
import java.net.ConnectException; |
27 | 27 |
import java.net.MalformedURLException; |
28 | 28 |
import java.net.URL; |
29 |
import java.util.ArrayList; |
|
30 | 29 |
import java.util.List; |
31 | 30 |
|
32 | 31 |
import org.gvsig.compat.net.ICancellable; |
... | ... | |
86 | 85 |
* <p> Reads from the WMS Capabilities, the layers available in the service</p> |
87 | 86 |
* @return a TreeMap with the available layers in the WMS |
88 | 87 |
*/ |
89 |
public ArrayList getLayers() {
|
|
88 |
public List<WMTSLayer> getLayers() {
|
|
90 | 89 |
if(serverDescription != null) |
91 | 90 |
return serverDescription.getLayerList(); |
92 | 91 |
return null; |
... | ... | |
189 | 188 |
* @param layerTitle |
190 | 189 |
* @return |
191 | 190 |
*/ |
192 |
public ArrayList getFormats(String layerTitle) {
|
|
191 |
public List<String> getFormats(String layerTitle) {
|
|
193 | 192 |
if(serverDescription != null) |
194 | 193 |
return serverDescription.getLayerByTitle(layerTitle).getFormat(); |
195 | 194 |
return null; |
... | ... | |
225 | 224 |
|
226 | 225 |
public WMTSLayer getLayer(String layerName) { |
227 | 226 |
if(serverDescription != null) { |
228 |
ArrayList list = serverDescription.getLayerList();
|
|
227 |
List<WMTSLayer> list = serverDescription.getLayerList();
|
|
229 | 228 |
for (int i = 0; i < list.size(); i++) { |
230 | 229 |
WMTSLayerImpl layer = (WMTSLayerImpl)list.get(i); |
231 | 230 |
if(layer.getTitle().compareTo(layerName) == 0) { |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/struct/WMTSLegendURL.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.raster.wmts.ogc.impl.struct; |
|
23 |
|
|
24 |
import java.io.IOException; |
|
25 |
|
|
26 |
import org.kxml2.io.KXmlParser; |
|
27 |
import org.xmlpull.v1.XmlPullParserException; |
|
28 |
|
|
29 |
/** |
|
30 |
* Description of an image that represents the legend of the map |
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
32 |
*/ |
|
33 |
public abstract class WMTSLegendURL { |
|
34 |
private int width = 0; |
|
35 |
private int height = 0; |
|
36 |
private double minScaleDenominator = 0; |
|
37 |
private double maxScaleDenominator = 0; |
|
38 |
private String format = ""; |
|
39 |
private String href = ""; |
|
40 |
|
|
41 |
/** |
|
42 |
* Parses this service |
|
43 |
* @param parser |
|
44 |
* @param content |
|
45 |
* @throws IOException |
|
46 |
* @throws XmlPullParserException |
|
47 |
*/ |
|
48 |
public abstract void parse(KXmlParser parser) throws IOException, XmlPullParserException; |
|
49 |
|
|
50 |
|
|
51 |
public int getWidth() { |
|
52 |
return width; |
|
53 |
} |
|
54 |
|
|
55 |
public void setWidth(int width) { |
|
56 |
this.width = width; |
|
57 |
} |
|
58 |
|
|
59 |
public int getHeight() { |
|
60 |
return height; |
|
61 |
} |
|
62 |
|
|
63 |
public void setHeight(int height) { |
|
64 |
this.height = height; |
|
65 |
} |
|
66 |
|
|
67 |
public double getMinScaleDenominator() { |
|
68 |
return minScaleDenominator; |
|
69 |
} |
|
70 |
|
|
71 |
public void setMinScaleDenominator(double minScaleDenominator) { |
|
72 |
this.minScaleDenominator = minScaleDenominator; |
|
73 |
} |
|
74 |
|
|
75 |
public double getMaxScaleDenominator() { |
|
76 |
return maxScaleDenominator; |
|
77 |
} |
|
78 |
|
|
79 |
public void setMaxScaleDenominator(double maxScaleDenominator) { |
|
80 |
this.maxScaleDenominator = maxScaleDenominator; |
|
81 |
} |
|
82 |
|
|
83 |
public String getFormat() { |
|
84 |
return format; |
|
85 |
} |
|
86 |
|
|
87 |
public void setFormat(String format) { |
|
88 |
this.format = format; |
|
89 |
} |
|
90 |
|
|
91 |
public String getHref() { |
|
92 |
return href; |
|
93 |
} |
|
94 |
|
|
95 |
public void setHref(String href) { |
|
96 |
this.href = href; |
|
97 |
} |
|
98 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/struct/WMTSTheme.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.raster.wmts.ogc.impl.struct; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
|
|
26 |
/** |
|
27 |
* Layer hierarchy |
|
28 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
29 |
*/ |
|
30 |
public abstract class WMTSTheme extends WMTSBaseStruct { |
|
31 |
//WMTSTheme |
|
32 |
private ArrayList theme = null; |
|
33 |
//String |
|
34 |
private ArrayList layerRef = null; |
|
35 |
private WMTSLayerImpl layer = null; |
|
36 |
|
|
37 |
public void setLayer(WMTSLayerImpl layer) { |
|
38 |
this.layer = layer; |
|
39 |
} |
|
40 |
|
|
41 |
public WMTSLayerImpl getLayer() { |
|
42 |
return layer; |
|
43 |
} |
|
44 |
|
|
45 |
public ArrayList getThemeList() { |
|
46 |
if(theme == null) |
|
47 |
theme = new ArrayList(); |
|
48 |
return theme; |
|
49 |
} |
|
50 |
|
|
51 |
public ArrayList getLayerRef() { |
|
52 |
if(layerRef == null) |
|
53 |
layerRef = new ArrayList(); |
|
54 |
return layerRef; |
|
55 |
} |
|
56 |
|
|
57 |
/** |
|
58 |
* Assign the layer associated |
|
59 |
* @param layers |
|
60 |
*/ |
|
61 |
public void calculateLayers(ArrayList layers) { |
|
62 |
if(theme != null && theme.size() > 0) { |
|
63 |
for (int i = 0; i < theme.size(); i++) { |
|
64 |
((WMTSTheme)theme.get(i)).calculateLayers(layers); |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
if(layerRef != null && layerRef.size() > 0) { |
|
69 |
for (int i = 0; i < layers.size(); i++) { |
|
70 |
WMTSLayerImpl tmpLayer = (WMTSLayerImpl)layers.get(i); |
|
71 |
for (int j = 0; j < layerRef.size(); j++) { |
|
72 |
String layerRef_I = (String)layerRef.get(j); |
|
73 |
if(tmpLayer.getTitle().compareTo(layerRef_I) == 0) { |
|
74 |
layer = tmpLayer; |
|
75 |
} |
|
76 |
} |
|
77 |
} |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* Gets a node by its name |
|
83 |
* @param name |
|
84 |
* @return |
|
85 |
*/ |
|
86 |
public WMTSTheme getNodeByName(String name) { |
|
87 |
WMTSTheme result = null; |
|
88 |
if(theme == null) |
|
89 |
return null; |
|
90 |
|
|
91 |
for (int i = 0; i < theme.size(); i++) { |
|
92 |
WMTSTheme t = ((WMTSTheme)(theme.get(i))); |
|
93 |
String title = t.getTitle(); |
|
94 |
|
|
95 |
if(title.compareTo(name) == 0) |
|
96 |
result = t; |
|
97 |
else |
|
98 |
result = t.getNodeByName(name); |
|
99 |
|
|
100 |
if(result != null) |
|
101 |
return result; |
|
102 |
} |
|
103 |
|
|
104 |
return null; |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* Gets the number of nodes |
|
109 |
* @param parent |
|
110 |
* @return |
|
111 |
*/ |
|
112 |
public int getChildCount() { |
|
113 |
if(theme == null || theme.size() == 0) |
|
114 |
return 0; |
|
115 |
else { |
|
116 |
int acum = 0; |
|
117 |
for (int i = 0; i < theme.size(); i++) { |
|
118 |
acum += 1 + ((WMTSTheme)theme.get(i)).getChildCount(); |
|
119 |
} |
|
120 |
return acum; |
|
121 |
} |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* Gets the children of the index position |
|
126 |
* @param index |
|
127 |
* @return |
|
128 |
*/ |
|
129 |
public WMTSTheme getChildren(int index) { |
|
130 |
if(theme != null) |
|
131 |
return (WMTSTheme)theme.get(index); |
|
132 |
return null; |
|
133 |
} |
|
134 |
|
|
135 |
/** |
|
136 |
* Gets the index of a children |
|
137 |
* @param parent |
|
138 |
* @param child |
|
139 |
* @return |
|
140 |
*/ |
|
141 |
public int getIndexOfChild(WMTSTheme child) { |
|
142 |
if(theme != null) { |
|
143 |
for (int i = 0; i < theme.size(); i++) |
|
144 |
if (child == getChildren(i)) |
|
145 |
return i; |
|
146 |
} |
|
147 |
return -1; |
|
148 |
} |
|
149 |
|
|
150 |
public String toString() { |
|
151 |
return this.getTitle(); |
|
152 |
} |
|
153 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/struct/WMTSStyle.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.raster.wmts.ogc.impl.struct; |
|
23 |
|
|
24 |
/** |
|
25 |
* <p>Defines a OGC style. Theme that describes the appeareance of certain layer.</p> |
|
26 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
27 |
*/ |
|
28 |
public abstract class WMTSStyle extends WMTSBaseStruct { |
|
29 |
protected WMTSLegendURL legendURL = null; |
|
30 |
private boolean isDefault = false; |
|
31 |
|
|
32 |
public abstract WMTSLegendURL getLegendURL(); |
|
33 |
|
|
34 |
public boolean isDefault() { |
|
35 |
return isDefault; |
|
36 |
} |
|
37 |
|
|
38 |
public void setDefault(boolean isDefault) { |
|
39 |
this.isDefault = isDefault; |
|
40 |
} |
|
41 |
|
|
42 |
public String toString() { |
|
43 |
return getTitle(); |
|
44 |
} |
|
45 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/struct/WMTSTileMatrixSetImpl.java | ||
---|---|---|
36 | 36 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
37 | 37 |
*/ |
38 | 38 |
public abstract class WMTSTileMatrixSetImpl extends WMTSBaseStruct implements WMTSTileMatrixSet { |
39 |
protected WMTSBoundingBoxImpl bbox = null; |
|
40 |
private String supportedCRS = null; |
|
41 |
private String wellKnownScaleSet = null; |
|
42 |
//WMTSTileMatrix |
|
43 |
protected ArrayList tileMatrix = null; |
|
44 |
protected boolean forceLongitudeFirstAxisOrder = false; |
|
39 |
protected WMTSBoundingBoxImpl bbox = null; |
|
40 |
private String supportedCRS = null; |
|
41 |
private String wellKnownScaleSet = null; |
|
42 |
protected List<WMTSTileMatrix> tileMatrix = null; |
|
43 |
protected boolean forceLongitudeFirstAxisOrder = false; |
|
45 | 44 |
|
46 | 45 |
/** |
47 | 46 |
* Sets longitude first in the axis order read from the capabilities file |
... | ... | |
58 | 57 |
* @throws IOException |
59 | 58 |
* @throws XmlPullParserException |
60 | 59 |
*/ |
61 |
public abstract void parse(KXmlParser parser, ArrayList list) throws IOException, XmlPullParserException;
|
|
60 |
public abstract void parse(KXmlParser parser, List<WMTSTileMatrixSet> list) throws IOException, XmlPullParserException;
|
|
62 | 61 |
|
63 | 62 |
public void setLayerBBox(WMTSBoundingBoxImpl bbox) { |
64 | 63 |
if(bbox != null) { |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/struct/WMTSStyleImpl.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.raster.wmts.ogc.impl.struct; |
|
23 |
|
|
24 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLegendURL; |
|
25 |
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle; |
|
26 |
|
|
27 |
/** |
|
28 |
* <p>Defines a OGC style. Theme that describes the appeareance of certain layer.</p> |
|
29 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
30 |
*/ |
|
31 |
public abstract class WMTSStyleImpl extends WMTSBaseStruct implements WMTSStyle { |
|
32 |
protected WMTSLegendURLImpl legendURL = null; |
|
33 |
private boolean isDefault = false; |
|
34 |
|
|
35 |
public abstract WMTSLegendURL getLegendURL(); |
|
36 |
|
|
37 |
public boolean isDefault() { |
|
38 |
return isDefault; |
|
39 |
} |
|
40 |
|
|
41 |
public void setDefault(boolean isDefault) { |
|
42 |
this.isDefault = isDefault; |
|
43 |
} |
|
44 |
|
|
45 |
public String toString() { |
|
46 |
return getTitle(); |
|
47 |
} |
|
48 |
} |
|
0 | 49 |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/struct/WMTSLegendURLImpl.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.raster.wmts.ogc.impl.struct; |
|
23 |
|
|
24 |
import java.io.IOException; |
|
25 |
|
|
26 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLegendURL; |
|
27 |
import org.kxml2.io.KXmlParser; |
|
28 |
import org.xmlpull.v1.XmlPullParserException; |
|
29 |
|
|
30 |
/** |
|
31 |
* Description of an image that represents the legend of the map |
|
32 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
33 |
*/ |
|
34 |
public abstract class WMTSLegendURLImpl implements WMTSLegendURL { |
|
35 |
private int width = 0; |
|
36 |
private int height = 0; |
|
37 |
private double minScaleDenominator = 0; |
|
38 |
private double maxScaleDenominator = 0; |
|
39 |
private String format = ""; |
|
40 |
private String href = ""; |
|
41 |
|
|
42 |
/** |
|
43 |
* Parses this service |
|
44 |
* @param parser |
|
45 |
* @param content |
|
46 |
* @throws IOException |
|
47 |
* @throws XmlPullParserException |
|
48 |
*/ |
|
49 |
public abstract void parse(KXmlParser parser) throws IOException, XmlPullParserException; |
|
50 |
|
|
51 |
|
|
52 |
public int getWidth() { |
|
53 |
return width; |
|
54 |
} |
|
55 |
|
|
56 |
public void setWidth(int width) { |
|
57 |
this.width = width; |
|
58 |
} |
|
59 |
|
|
60 |
public int getHeight() { |
|
61 |
return height; |
|
62 |
} |
|
63 |
|
|
64 |
public void setHeight(int height) { |
|
65 |
this.height = height; |
|
66 |
} |
|
67 |
|
|
68 |
public double getMinScaleDenominator() { |
|
69 |
return minScaleDenominator; |
|
70 |
} |
|
71 |
|
|
72 |
public void setMinScaleDenominator(double minScaleDenominator) { |
|
73 |
this.minScaleDenominator = minScaleDenominator; |
|
74 |
} |
|
75 |
|
|
76 |
public double getMaxScaleDenominator() { |
|
77 |
return maxScaleDenominator; |
|
78 |
} |
|
79 |
|
|
80 |
public void setMaxScaleDenominator(double maxScaleDenominator) { |
|
81 |
this.maxScaleDenominator = maxScaleDenominator; |
|
82 |
} |
|
83 |
|
|
84 |
public String getFormat() { |
|
85 |
return format; |
|
86 |
} |
|
87 |
|
|
88 |
public void setFormat(String format) { |
|
89 |
this.format = format; |
|
90 |
} |
|
91 |
|
|
92 |
public String getHref() { |
|
93 |
return href; |
|
94 |
} |
|
95 |
|
|
96 |
public void setHref(String href) { |
|
97 |
this.href = href; |
|
98 |
} |
|
99 |
} |
|
0 | 100 |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/struct/WMTSThemeImpl.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.raster.wmts.ogc.impl.struct; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
import java.util.List; |
|
26 |
|
|
27 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer; |
|
28 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTheme; |
|
29 |
|
|
30 |
/** |
|
31 |
* Layer hierarchy |
|
32 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
33 |
*/ |
|
34 |
public abstract class WMTSThemeImpl extends WMTSBaseStruct implements WMTSTheme { |
|
35 |
private List<WMTSTheme> theme = null; |
|
36 |
private List<String> layerRef = null; |
|
37 |
private WMTSLayerImpl layer = null; |
|
38 |
|
|
39 |
public void setLayer(WMTSLayerImpl layer) { |
|
40 |
this.layer = layer; |
|
41 |
} |
|
42 |
|
|
43 |
public WMTSLayer getLayer() { |
|
44 |
return layer; |
|
45 |
} |
|
46 |
|
|
47 |
public List<WMTSTheme> getThemeList() { |
|
48 |
if(theme == null) |
|
49 |
theme = new ArrayList<WMTSTheme>(); |
|
50 |
return theme; |
|
51 |
} |
|
52 |
|
|
53 |
public List<String> getLayerRef() { |
|
54 |
if(layerRef == null) |
|
55 |
layerRef = new ArrayList<String>(); |
|
56 |
return layerRef; |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* Assign the layer associated |
|
61 |
* @param layers |
|
62 |
*/ |
|
63 |
public void calculateLayers(List<WMTSLayer> layers) { |
|
64 |
if(theme != null && theme.size() > 0) { |
|
65 |
for (int i = 0; i < theme.size(); i++) { |
|
66 |
((WMTSThemeImpl)theme.get(i)).calculateLayers(layers); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
if(layerRef != null && layerRef.size() > 0) { |
|
71 |
for (int i = 0; i < layers.size(); i++) { |
|
72 |
WMTSLayerImpl tmpLayer = (WMTSLayerImpl)layers.get(i); |
|
73 |
for (int j = 0; j < layerRef.size(); j++) { |
|
74 |
String layerRef_I = (String)layerRef.get(j); |
|
75 |
if(tmpLayer.getTitle().compareTo(layerRef_I) == 0) { |
|
76 |
layer = tmpLayer; |
|
77 |
} |
|
78 |
} |
|
79 |
} |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* Gets a node by its name |
|
85 |
* @param name |
|
86 |
* @return |
|
87 |
*/ |
|
88 |
public WMTSTheme getNodeByName(String name) { |
|
89 |
WMTSTheme result = null; |
|
90 |
if(theme == null) |
|
91 |
return null; |
|
92 |
|
|
93 |
for (int i = 0; i < theme.size(); i++) { |
|
94 |
WMTSThemeImpl t = ((WMTSThemeImpl)(theme.get(i))); |
|
95 |
String title = t.getTitle(); |
|
96 |
|
|
97 |
if(title.compareTo(name) == 0) |
|
98 |
result = t; |
|
99 |
else |
|
100 |
result = t.getNodeByName(name); |
|
101 |
|
|
102 |
if(result != null) |
|
103 |
return result; |
|
104 |
} |
|
105 |
|
|
106 |
return null; |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* Gets the number of nodes |
|
111 |
* @param parent |
|
112 |
* @return |
|
113 |
*/ |
|
114 |
public int getChildCount() { |
|
115 |
if(theme == null || theme.size() == 0) |
|
116 |
return 0; |
|
117 |
else { |
|
118 |
int acum = 0; |
|
119 |
for (int i = 0; i < theme.size(); i++) { |
|
120 |
acum += 1 + ((WMTSThemeImpl)theme.get(i)).getChildCount(); |
|
121 |
} |
|
122 |
return acum; |
|
123 |
} |
|
124 |
} |
|
125 |
|
|
126 |
/** |
|
127 |
* Gets the children of the index position |
|
128 |
* @param index |
|
129 |
* @return |
|
130 |
*/ |
|
131 |
public WMTSTheme getChildren(int index) { |
|
132 |
if(theme != null) |
|
133 |
return theme.get(index); |
|
134 |
return null; |
|
135 |
} |
|
136 |
|
|
137 |
/** |
|
138 |
* Gets the index of a children |
|
139 |
* @param parent |
|
140 |
* @param child |
|
141 |
* @return |
|
142 |
*/ |
|
143 |
public int getIndexOfChild(WMTSTheme child) { |
|
144 |
if(theme != null) { |
|
145 |
for (int i = 0; i < theme.size(); i++) |
|
146 |
if (child == getChildren(i)) |
|
147 |
return i; |
|
148 |
} |
|
149 |
return -1; |
|
150 |
} |
|
151 |
|
|
152 |
public String toString() { |
|
153 |
return this.getTitle(); |
|
154 |
} |
|
155 |
} |
|
0 | 156 |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/struct/WMTSTileMatrixImpl.java | ||
---|---|---|
30 | 30 |
import java.util.ArrayList; |
31 | 31 |
import java.util.List; |
32 | 32 |
|
33 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTile; |
|
33 | 34 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrix; |
34 | 35 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixLimits; |
35 | 36 |
import org.kxml2.io.KXmlParser; |
... | ... | |
68 | 69 |
return bboxTileMatrixSet; |
69 | 70 |
} |
70 | 71 |
|
71 |
public class InternalTileImpl { |
|
72 |
public class InternalTileImpl implements WMTSTile {
|
|
72 | 73 |
public int wPx, hPx; |
73 | 74 |
public int row, col; |
74 | 75 |
public double ulx, uly, lrx, lry; |
... | ... | |
103 | 104 |
return p; |
104 | 105 |
} |
105 | 106 |
|
106 |
public InternalTileImpl cloneTile() {
|
|
107 |
public WMTSTile cloneTile() {
|
|
107 | 108 |
InternalTileImpl status = new InternalTileImpl(wPx, hPx, row, col, ulx, uly, lrx, lry); |
108 | 109 |
status.file = file; |
109 | 110 |
return status; |
... | ... | |
219 | 220 |
* intersects then this will be added to the list. |
220 | 221 |
* @deprecated this method was for grid subsets. |
221 | 222 |
*/ |
222 |
public ArrayList intersects(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Rectangle2D request, Rectangle2D extentLayer) {
|
|
223 |
public List<WMTSTile> intersects(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Rectangle2D request, Rectangle2D extentLayer) {
|
|
223 | 224 |
double widthMtsTile = getWidthWCTile(projected); |
224 | 225 |
double heightMtsTile = getHeightWCTile(projected); |
225 | 226 |
|
226 | 227 |
double ulx, uly, lrx, lry; |
227 |
ArrayList list = new ArrayList();
|
|
228 |
List<WMTSTile> list = new ArrayList<WMTSTile>();
|
|
228 | 229 |
Rectangle2D r = new Rectangle2D.Double(0, 0, 0, 0); |
229 | 230 |
|
230 | 231 |
//Recorre la matriz de tiles calculando las coordenadas de cada tile |
... | ... | |
260 | 261 |
* This function will check if the request coordinates intersects with the tiles in the matrix. If a tile |
261 | 262 |
* intersects then this will be added to the list. |
262 | 263 |
*/ |
263 |
public ArrayList intersects(boolean projected, Rectangle2D request, Rectangle2D extentLayer) {
|
|
264 |
public List<WMTSTile> intersects(boolean projected, Rectangle2D request, Rectangle2D extentLayer) {
|
|
264 | 265 |
double widthWorldCoordTile = getWidthWCTile(projected); |
265 | 266 |
double heightWorldCoordTile = getHeightWCTile(projected); |
266 | 267 |
|
267 | 268 |
double ulx, uly, lrx, lry; |
268 |
ArrayList list = new ArrayList();
|
|
269 |
List<WMTSTile> list = new ArrayList<WMTSTile>();
|
|
269 | 270 |
Rectangle2D r = new Rectangle2D.Double(0, 0, 0, 0); |
270 | 271 |
|
271 | 272 |
//Recorre la matriz de tiles calculando las coordenadas de cada tile |
... | ... | |
331 | 332 |
* This function will check if the request coordinates intersects with the tiles in the matrix. If a tile |
332 | 333 |
* intersects then this will be added to the list. |
333 | 334 |
*/ |
334 |
public ArrayList contains(boolean projected, Point2D point, Rectangle2D extentLayer) {
|
|
335 |
public List<WMTSTile> contains(boolean projected, Point2D point, Rectangle2D extentLayer) {
|
|
335 | 336 |
double widthMtsTile = getWidthWCTile(projected); //getWidthMtsTile(projected); |
336 | 337 |
double heightMtsTile = getHeightWCTile(projected); //getHeightMtsTile(projected); |
337 | 338 |
|
338 | 339 |
double ulx, uly, lrx, lry; |
339 |
ArrayList list = new ArrayList();
|
|
340 |
List<WMTSTile> list = new ArrayList<WMTSTile>();
|
|
340 | 341 |
Rectangle2D r = new Rectangle2D.Double(0, 0, 0, 0); |
341 | 342 |
|
342 | 343 |
//Recorre la matriz de tiles calculando las coordenadas de cada tile |
... | ... | |
371 | 372 |
* This function will check if the request coordinates intersects with the tiles in the matrix. If a tile |
372 | 373 |
* intersects then this will be added to the list. |
373 | 374 |
*/ |
374 |
public ArrayList contains(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Point2D point, Rectangle2D extentLayer) {
|
|
375 |
public List<WMTSTile> contains(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Point2D point, Rectangle2D extentLayer) {
|
|
375 | 376 |
double widthMtsTile = getWidthWCTile(projected); |
376 | 377 |
double heightMtsTile = getHeightWCTile(projected); |
377 | 378 |
|
378 | 379 |
double ulx, uly, lrx, lry; |
379 |
ArrayList list = new ArrayList();
|
|
380 |
List<WMTSTile> list = new ArrayList<WMTSTile>();
|
|
380 | 381 |
Rectangle2D r = new Rectangle2D.Double(0, 0, 0, 0); |
381 | 382 |
|
382 | 383 |
//Recorre la matriz de tiles calculando las coordenadas de cada tile |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/struct/WMTSTileMatrixLimitsImpl.java | ||
---|---|---|
22 | 22 |
package org.gvsig.raster.wmts.ogc.impl.struct; |
23 | 23 |
|
24 | 24 |
import java.io.IOException; |
Also available in: Unified diff