Revision 1812
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/wmts/io/TestWMTSDriver.java | ||
---|---|---|
25 | 25 |
import java.net.URL; |
26 | 26 |
|
27 | 27 |
import org.gvsig.fmap.dal.exception.InitializeException; |
28 |
import org.gvsig.remoteclient.wmts.exception.WMTSException;
|
|
29 |
import org.gvsig.remoteclient.wmts.struct.WMTSServiceIdentification;
|
|
30 |
import org.gvsig.remoteclient.wmts.struct.WMTSServiceProvider;
|
|
28 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException;
|
|
29 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceIdentification;
|
|
30 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceProvider;
|
|
31 | 31 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
32 | 32 |
|
33 | 33 |
/** |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/dialog/WMTSPropsDialog.java | ||
---|---|---|
48 | 48 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.WMTSParamsPanel; |
49 | 49 |
import org.gvsig.raster.wmts.app.wmtsclient.layer.FLyrWMTS; |
50 | 50 |
import org.gvsig.raster.wmts.io.WMTSServerExplorer; |
51 |
import org.gvsig.remoteclient.wmts.exception.WMTSException;
|
|
51 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException;
|
|
52 | 52 |
|
53 | 53 |
|
54 | 54 |
/** |
... | ... | |
80 | 80 |
HashMap<String, Object> hash = layer != null ? layer.getProperties() : null; |
81 | 81 |
wmtsGUIInterface = getParamsPanel(hash); |
82 | 82 |
wmtsGUIInterface.addWizardListener(new WizardListener(){ |
83 |
@SuppressWarnings("deprecation") |
|
84 | 83 |
public void wizardStateChanged(boolean finishable) { |
85 | 84 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(finishable); |
86 | 85 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(finishable); |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/panel/StyleTree.java | ||
---|---|---|
25 | 25 |
import java.awt.Color; |
26 | 26 |
import java.awt.Component; |
27 | 27 |
import java.util.ArrayList; |
28 |
import java.util.List; |
|
28 | 29 |
import java.util.Vector; |
29 | 30 |
|
30 | 31 |
import javax.swing.JLabel; |
... | ... | |
37 | 38 |
import javax.swing.tree.TreePath; |
38 | 39 |
|
39 | 40 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.WMTSParamsPanel.LayerUI; |
40 |
import org.gvsig.remoteclient.wmts.struct.WMTSStyle;
|
|
41 |
import org.gvsig.remoteclient.wmts.struct.WMTSTheme;
|
|
41 |
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle;
|
|
42 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTheme;
|
|
42 | 43 |
|
43 | 44 |
|
44 | 45 |
/** |
... | ... | |
244 | 245 |
* @return <b>True</b>, if the added branch actually defines any style. |
245 | 246 |
* <b>False</b>, if the layer has no styles. |
246 | 247 |
*/ |
247 |
@SuppressWarnings("unchecked") |
|
248 | 248 |
public boolean addLayerBranch(LayerUI node) { |
249 | 249 |
layers.add(node); |
250 | 250 |
|
251 | 251 |
//Si no hay ninguno seleccionado seleccionamos el primero |
252 | 252 |
for (int i = 0; i < layers.size(); i++) { |
253 | 253 |
if(layers.get(i).styleSelected == null) { |
254 |
ArrayList<WMTSStyle> sty = layers.get(i).theme.getLayer().getStyle();
|
|
254 |
List<WMTSStyle> sty = layers.get(i).theme.getLayer().getStyle(); |
|
255 | 255 |
if(sty != null && sty.size() > 0 && sty.get(0) != null) |
256 | 256 |
layers.get(i).styleSelected = sty.get(0); |
257 | 257 |
} |
... | ... | |
332 | 332 |
return layers.get(index); |
333 | 333 |
} |
334 | 334 |
|
335 |
/* |
|
336 |
* (non-Javadoc) |
|
337 |
* @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object) |
|
338 |
*/ |
|
339 |
@SuppressWarnings("unchecked") |
|
340 | 335 |
public int getIndexOfChild(Object parent, Object child) { |
341 | 336 |
if (parent instanceof LayerUI && child instanceof WMTSStyle) { |
342 |
ArrayList<WMTSStyle> listStyle = ((LayerUI)parent).theme.getLayer().getStyle();
|
|
337 |
List<WMTSStyle> listStyle = ((LayerUI)parent).theme.getLayer().getStyle(); |
|
343 | 338 |
for (int i = 0; i < listStyle.size(); i++) { |
344 | 339 |
WMTSStyle sty = listStyle.get(i); |
345 | 340 |
if(sty.equals(child)) |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/panel/InfoPanel.java | ||
---|---|---|
32 | 32 |
import org.gvsig.andami.PluginServices; |
33 | 33 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.WMTSParamsPanel.LayerUI; |
34 | 34 |
import org.gvsig.raster.wmts.io.WMTSServerExplorer; |
35 |
import org.gvsig.remoteclient.wmts.struct.WMTSServiceIdentification;
|
|
36 |
import org.gvsig.remoteclient.wmts.struct.WMTSTheme;
|
|
35 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceIdentification;
|
|
36 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTheme;
|
|
37 | 37 |
|
38 | 38 |
|
39 | 39 |
/** |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/panel/layer/LayerTree.java | ||
---|---|---|
31 | 31 |
|
32 | 32 |
import org.gvsig.andami.PluginServices; |
33 | 33 |
import org.gvsig.gui.beans.controls.MultiLineToolTip; |
34 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer;
|
|
34 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer;
|
|
35 | 35 |
|
36 | 36 |
|
37 | 37 |
/** |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/panel/WMTSParamsPanel.java | ||
---|---|---|
36 | 36 |
import java.awt.event.MouseListener; |
37 | 37 |
import java.util.ArrayList; |
38 | 38 |
import java.util.HashMap; |
39 |
import java.util.List; |
|
39 | 40 |
import java.util.Vector; |
40 | 41 |
import java.util.prefs.Preferences; |
41 | 42 |
|
... | ... | |
68 | 69 |
import org.gvsig.raster.wmts.app.wmtsclient.layer.FLyrWMTS; |
69 | 70 |
import org.gvsig.raster.wmts.io.WMTSDataParameters; |
70 | 71 |
import org.gvsig.raster.wmts.io.WMTSServerExplorer; |
71 |
import org.gvsig.remoteclient.wmts.struct.WMTSStyle;
|
|
72 |
import org.gvsig.remoteclient.wmts.struct.WMTSTheme;
|
|
72 |
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle;
|
|
73 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTheme;
|
|
73 | 74 |
|
74 | 75 |
|
75 | 76 |
/** |
... | ... | |
564 | 565 |
((WMTSParametersListModel)getImageFormats().getModel()).removeAllItems(); |
565 | 566 |
} |
566 | 567 |
if(selectedValues != null && selectedValues.length == 1) { |
567 |
ArrayList formats = ((LayerUI)selectedValues[0]).theme.getLayer().getFormat();
|
|
568 |
List<String> formats = ((LayerUI)selectedValues[0]).theme.getLayer().getFormat();
|
|
568 | 569 |
WMTSParametersListModel model = new WMTSParametersListModel(formats); |
569 | 570 |
getImageFormats().setModel(model); |
570 | 571 |
getImageFormats().setSelectedIndex(((LayerUI)selectedValues[0]).imageFormatSelected); |
... | ... | |
582 | 583 |
((WMTSParametersListModel)getInfoFormats().getModel()).removeAllItems(); |
583 | 584 |
} |
584 | 585 |
if(selectedValues != null && selectedValues.length == 1) { |
585 |
ArrayList formats = ((LayerUI)selectedValues[0]).theme.getLayer().getInfoFormat();
|
|
586 |
List<String> formats = ((LayerUI)selectedValues[0]).theme.getLayer().getInfoFormat();
|
|
586 | 587 |
WMTSParametersListModel model = new WMTSParametersListModel(formats); |
587 | 588 |
getInfoFormats().setModel(model); |
588 | 589 |
getInfoFormats().setSelectedIndex(((LayerUI)selectedValues[0]).infoFormatSelected); |
... | ... | |
600 | 601 |
((WMTSParametersListModel)getLstSRSs().getModel()).removeAllItems(); |
601 | 602 |
} |
602 | 603 |
if(selectedValues != null && selectedValues.length == 1) { |
603 |
ArrayList formats = ((LayerUI)selectedValues[0]).theme.getLayer().getSrsList();
|
|
604 |
List<String> formats = ((LayerUI)selectedValues[0]).theme.getLayer().getSrsList();
|
|
604 | 605 |
WMTSParametersListModel model = new WMTSParametersListModel(formats); |
605 | 606 |
getLstSRSs().setModel(model); |
606 | 607 |
getLstSRSs().setSelectedIndex(((LayerUI)selectedValues[0]).srsFormatSelected); |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/wizard/WMTSParametersListModel.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import java.util.ArrayList; |
26 | 26 |
import java.util.Collection; |
27 |
import java.util.List; |
|
27 | 28 |
import java.util.TreeSet; |
28 | 29 |
|
29 | 30 |
import javax.swing.AbstractListModel; |
... | ... | |
41 | 42 |
srs = obj; |
42 | 43 |
} |
43 | 44 |
|
45 |
public WMTSParametersListModel(List<String> obj) { |
|
46 |
for (int i = 0; i < obj.size(); i++) |
|
47 |
srs.add(obj.get(i)); |
|
48 |
} |
|
49 |
|
|
44 | 50 |
public WMTSParametersListModel() { |
45 | 51 |
} |
46 | 52 |
|
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/wizard/WMTSWizard.java | ||
---|---|---|
52 | 52 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
53 | 53 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
54 | 54 |
import org.gvsig.gui.beans.Messages; |
55 |
import org.gvsig.raster.tools.app.basic.RasterToolsUtil; |
|
56 | 55 |
import org.gvsig.raster.util.CancelTaskImpl; |
57 | 56 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.WMTSParamsPanel; |
58 | 57 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.IServerPanel; |
... | ... | |
61 | 60 |
import org.gvsig.raster.wmts.io.WMTSDataParameters; |
62 | 61 |
import org.gvsig.raster.wmts.io.WMTSServerExplorer; |
63 | 62 |
import org.gvsig.raster.wmts.io.WMTSServerExplorerParameters; |
64 |
import org.gvsig.remoteclient.wmts.exception.WMTSException;
|
|
65 |
import org.gvsig.remoteclient.wmts.struct.WMTSServiceIdentification;
|
|
63 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException;
|
|
64 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceIdentification;
|
|
66 | 65 |
import org.gvsig.utils.NotExistInXMLEntity; |
67 | 66 |
import org.gvsig.utils.XMLEntity; |
68 | 67 |
import org.gvsig.utils.swing.jcomboServer.ServerData; |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/wizard/LayerTreeModel.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
package org.gvsig.raster.wmts.app.wmtsclient.gui.wizard; |
24 | 24 |
|
25 |
import java.util.ArrayList;
|
|
25 |
import java.util.List; |
|
26 | 26 |
|
27 | 27 |
import javax.swing.event.TreeModelListener; |
28 | 28 |
import javax.swing.tree.TreeModel; |
29 | 29 |
import javax.swing.tree.TreePath; |
30 | 30 |
|
31 |
import org.gvsig.remoteclient.wmts.struct.WMTSTheme; |
|
32 |
import org.gvsig.remoteclient.wmts.struct.WMTSThemes; |
|
31 |
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle; |
|
32 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTheme; |
|
33 |
import org.gvsig.raster.wmts.ogc.struct.WMTSThemes; |
|
33 | 34 |
|
34 | 35 |
/** |
35 | 36 |
* Model for the layer three |
36 | 37 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
37 | 38 |
*/ |
38 |
@SuppressWarnings("unchecked") |
|
39 | 39 |
public class LayerTreeModel implements TreeModel { |
40 | 40 |
|
41 | 41 |
private WMTSThemes root = null; |
... | ... | |
97 | 97 |
* @param node, the tree's desired node. |
98 | 98 |
* @return Returns the namedStyles. |
99 | 99 |
*/ |
100 |
public ArrayList getStyles(Object node) {
|
|
100 |
public List<WMTSStyle> getStyles(Object node) {
|
|
101 | 101 |
return ((WMTSTheme) node).getLayer().getStyle(); |
102 | 102 |
} |
103 | 103 |
|
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/pom.xml | ||
---|---|---|
34 | 34 |
</dependency> |
35 | 35 |
<dependency> |
36 | 36 |
<groupId>org.gvsig</groupId> |
37 |
<artifactId>org.gvsig.remoteclient</artifactId> |
|
38 |
<scope>compile</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 | 37 |
<artifactId>org.gvsig.app</artifactId> |
43 | 38 |
<scope>compile</scope> |
44 | 39 |
</dependency> |
... | ... | |
118 | 113 |
<artifactId>org.gvsig.compat</artifactId> |
119 | 114 |
<scope>compile</scope> |
120 | 115 |
</dependency> |
116 |
<dependency> |
|
117 |
<groupId>org.gvsig</groupId> |
|
118 |
<artifactId>org.gvsig.raster.wmts.ogc.api</artifactId> |
|
119 |
<scope>compile</scope> |
|
120 |
</dependency> |
|
121 | 121 |
</dependencies> |
122 | 122 |
<build> |
123 | 123 |
<plugins> |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/distribution/distribution.xml | ||
---|---|---|
24 | 24 |
<includes> |
25 | 25 |
<include>org.gvsig:org.gvsig.raster.wmts.app.wmtsclient:jar</include> |
26 | 26 |
<include>org.gvsig:org.gvsig.raster.wmts.io:jar</include> |
27 |
<include>org.gvsig:org.gvsig.remoteclient</include> |
|
27 |
<include>org.gvsig:org.gvsig.raster.wmts.ogc.api:jar</include> |
|
28 |
<include>org.gvsig:org.gvsig.raster.wmts.ogc.impl:jar</include> |
|
28 | 29 |
</includes> |
29 | 30 |
</dependencySet> |
30 | 31 |
</dependencySets> |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSServerExplorer.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import java.io.IOException; |
31 | 31 |
import java.net.URL; |
32 |
import java.util.ArrayList; |
|
33 | 32 |
import java.util.List; |
34 | 33 |
|
35 | 34 |
import org.gvsig.compat.net.ICancellable; |
... | ... | |
45 | 44 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
46 | 45 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProvider; |
47 | 46 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices; |
48 |
import org.gvsig.remoteclient.wmts.exception.WMTSException;
|
|
49 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer;
|
|
50 |
import org.gvsig.remoteclient.wmts.struct.WMTSServiceIdentification;
|
|
51 |
import org.gvsig.remoteclient.wmts.struct.WMTSServiceProvider;
|
|
52 |
import org.gvsig.remoteclient.wmts.struct.WMTSThemes;
|
|
53 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSet;
|
|
47 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException;
|
|
48 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer;
|
|
49 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceIdentification;
|
|
50 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceProvider;
|
|
51 |
import org.gvsig.raster.wmts.ogc.struct.WMTSThemes;
|
|
52 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSet;
|
|
54 | 53 |
|
55 | 54 |
/** |
56 | 55 |
* Explorer for a WMTS server |
... | ... | |
68 | 67 |
this.parameters = parameters; |
69 | 68 |
} |
70 | 69 |
|
71 |
/* |
|
72 |
* (non-Javadoc) |
|
73 |
* @see org.gvsig.fmap.dal.coverage.store.remote.RemoteServerExplorerProvider#getDataStoreProviderName() |
|
74 |
*/ |
|
75 | 70 |
public String getDataStoreProviderName() { |
76 | 71 |
return WMTSProvider.NAME; |
77 | 72 |
} |
78 | 73 |
|
79 |
/* |
|
80 |
* (non-Javadoc) |
|
81 |
* @see org.gvsig.fmap.dal.coverage.store.remote.RemoteServerExplorerProvider#getDescription() |
|
82 |
*/ |
|
83 | 74 |
public String getDescription() { |
84 | 75 |
return WMTSProvider.DESCRIPTION; |
85 | 76 |
} |
86 | 77 |
|
87 |
/* |
|
88 |
* (non-Javadoc) |
|
89 |
* @see org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer#getStoreParameters() |
|
90 |
*/ |
|
91 | 78 |
public DataStoreParameters getStoreParameters() { |
92 | 79 |
DataManager manager = DALLocator.getDataManager(); |
93 | 80 |
WMTSDataParameters wmtsParams = null; |
... | ... | |
165 | 152 |
//Connector |
166 | 153 |
//********************************************** |
167 | 154 |
|
168 |
/* |
|
169 |
* (non-Javadoc) |
|
170 |
* @see org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer#connect(org.gvsig.compat.net.ICancellable) |
|
171 |
*/ |
|
172 | 155 |
public void connect(ICancellable cancellable) throws WMTSException { |
173 | 156 |
URL url = null; |
174 | 157 |
boolean override = false; |
... | ... | |
188 | 171 |
} |
189 | 172 |
} |
190 | 173 |
|
191 |
/* |
|
192 |
* (non-Javadoc) |
|
193 |
* @see org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer#isConnected() |
|
194 |
*/ |
|
195 | 174 |
public boolean isConnected() { |
196 | 175 |
if(connector != null) |
197 | 176 |
return true; |
198 | 177 |
return false; |
199 | 178 |
} |
200 | 179 |
|
201 |
/* |
|
202 |
* (non-Javadoc) |
|
203 |
* @see org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer#getThemes() |
|
204 |
*/ |
|
205 | 180 |
public WMTSThemes getThemes() { |
206 | 181 |
return connector.getThemes(); |
207 | 182 |
} |
208 | 183 |
|
209 |
/* |
|
210 |
* (non-Javadoc) |
|
211 |
* @see org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer#getLayer(java.lang.String) |
|
212 |
*/ |
|
213 | 184 |
public WMTSLayer getLayer(String layerName) { |
214 | 185 |
return connector.getLayer(layerName); |
215 | 186 |
} |
216 | 187 |
|
217 |
/* |
|
218 |
* (non-Javadoc) |
|
219 |
* @see org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer#getTileMatrixSet() |
|
220 |
*/ |
|
221 |
public ArrayList<WMTSTileMatrixSet> getTileMatrixSet() { |
|
188 |
public List<WMTSTileMatrixSet> getTileMatrixSet() { |
|
222 | 189 |
return connector.getTileMatrixSet(); |
223 | 190 |
} |
224 | 191 |
|
225 |
/* |
|
226 |
* (non-Javadoc) |
|
227 |
* @see org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer#getServiceIdentification() |
|
228 |
*/ |
|
229 | 192 |
public WMTSServiceIdentification getServiceIdentification() { |
230 | 193 |
return connector.getServiceIdentification(); |
231 | 194 |
} |
232 | 195 |
|
233 |
/* |
|
234 |
* (non-Javadoc) |
|
235 |
* @see org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer#getServiceProvider() |
|
236 |
*/ |
|
237 | 196 |
public WMTSServiceProvider getServiceProvider() { |
238 | 197 |
return connector.getServiceProvider(); |
239 | 198 |
} |
240 | 199 |
|
241 |
/* |
|
242 |
* (non-Javadoc) |
|
243 |
* @see org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer#getHost() |
|
244 |
*/ |
|
245 | 200 |
public String getHost() { |
246 | 201 |
return parameters.getHost(); |
247 | 202 |
} |
248 | 203 |
|
249 |
/* |
|
250 |
* (non-Javadoc) |
|
251 |
* @see org.gvsig.fmap.dal.spi.DataServerExplorerProvider#getServerExplorerProviderServices() |
|
252 |
*/ |
|
253 | 204 |
public DataServerExplorerProviderServices getServerExplorerProviderServices() { |
254 | 205 |
return null; |
255 | 206 |
} |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSConnector.java | ||
---|---|---|
26 | 26 |
import java.net.ConnectException; |
27 | 27 |
import java.net.MalformedURLException; |
28 | 28 |
import java.net.URL; |
29 |
import java.util.ArrayList;
|
|
29 |
import java.util.List; |
|
30 | 30 |
|
31 | 31 |
import org.gvsig.compat.net.ICancellable; |
32 |
import org.gvsig.remoteclient.exceptions.ServerErrorException; |
|
33 |
import org.gvsig.remoteclient.wmts.WMTSClient; |
|
34 |
import org.gvsig.remoteclient.wmts.WMTSStatus; |
|
35 |
import org.gvsig.remoteclient.wmts.exception.DownloadException; |
|
36 |
import org.gvsig.remoteclient.wmts.exception.WMTSException; |
|
37 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer; |
|
38 |
import org.gvsig.remoteclient.wmts.struct.WMTSServiceIdentification; |
|
39 |
import org.gvsig.remoteclient.wmts.struct.WMTSServiceProvider; |
|
40 |
import org.gvsig.remoteclient.wmts.struct.WMTSThemes; |
|
41 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSet; |
|
32 |
import org.gvsig.raster.wmts.ogc.WMTSClient; |
|
33 |
import org.gvsig.raster.wmts.ogc.WMTSOGCLocator; |
|
34 |
import org.gvsig.raster.wmts.ogc.WMTSStatus; |
|
35 |
import org.gvsig.raster.wmts.ogc.exception.DownloadException; |
|
36 |
import org.gvsig.raster.wmts.ogc.exception.ServerErrorException; |
|
37 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException; |
|
38 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer; |
|
39 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceIdentification; |
|
40 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceProvider; |
|
41 |
import org.gvsig.raster.wmts.ogc.struct.WMTSThemes; |
|
42 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSet; |
|
42 | 43 |
|
43 | 44 |
/** |
44 | 45 |
* This class offers an interface of services for a WMTS |
... | ... | |
49 | 50 |
private WMTSClient client = null; |
50 | 51 |
|
51 | 52 |
public WMTSConnector(URL url) throws ConnectException, IOException { |
52 |
client = new WMTSClient(url.toString());
|
|
53 |
client = WMTSOGCLocator.getManager().createWMTSClient(url.toString());
|
|
53 | 54 |
} |
54 | 55 |
|
56 |
/** |
|
57 |
* Creates a <code>WMTSStatus</code> structure to make a request |
|
58 |
* @return |
|
59 |
*/ |
|
60 |
public WMTSStatus createStatus() { |
|
61 |
return client.createStatus(); |
|
62 |
} |
|
63 |
|
|
55 | 64 |
/** |
56 | 65 |
* Sets longitude first in the axis order |
57 | 66 |
* @param force |
... | ... | |
97 | 106 |
* Gets the set of tiles definition |
98 | 107 |
* @return |
99 | 108 |
*/ |
100 |
@SuppressWarnings("unchecked") |
|
101 |
public ArrayList<WMTSTileMatrixSet> getTileMatrixSet() { |
|
109 |
public List<WMTSTileMatrixSet> getTileMatrixSet() { |
|
102 | 110 |
return client.getTileMatrixSet(); |
103 | 111 |
} |
104 | 112 |
|
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSProvider.java | ||
---|---|---|
30 | 30 |
import java.net.ConnectException; |
31 | 31 |
import java.net.MalformedURLException; |
32 | 32 |
import java.net.URL; |
33 |
import java.util.ArrayList;
|
|
33 |
import java.util.List; |
|
34 | 34 |
|
35 | 35 |
import org.gvsig.compat.net.ICancellable; |
36 | 36 |
import org.gvsig.fmap.dal.DALLocator; |
... | ... | |
81 | 81 |
import org.gvsig.raster.impl.store.properties.RemoteStoreHistogram; |
82 | 82 |
import org.gvsig.raster.util.DefaultProviderServices; |
83 | 83 |
import org.gvsig.raster.wmts.io.downloader.WMTSTileServer; |
84 |
import org.gvsig.remoteclient.exceptions.ServerErrorException; |
|
85 |
import org.gvsig.remoteclient.wmts.WMTSStatus; |
|
86 |
import org.gvsig.remoteclient.wmts.exception.DownloadException; |
|
87 |
import org.gvsig.remoteclient.wmts.exception.WMTSException; |
|
88 |
import org.gvsig.remoteclient.wmts.struct.WMTSBoundingBox; |
|
89 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer; |
|
90 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix; |
|
91 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixLimits; |
|
92 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSet; |
|
93 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSetLink; |
|
94 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix.Tile; |
|
84 |
import org.gvsig.raster.wmts.ogc.WMTSOGCLocator; |
|
85 |
import org.gvsig.raster.wmts.ogc.WMTSStatus; |
|
86 |
import org.gvsig.raster.wmts.ogc.exception.DownloadException; |
|
87 |
import org.gvsig.raster.wmts.ogc.exception.ServerErrorException; |
|
88 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException; |
|
89 |
import org.gvsig.raster.wmts.ogc.struct.WMTSBoundingBox; |
|
90 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer; |
|
91 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTile; |
|
92 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrix; |
|
93 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixLimits; |
|
94 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSet; |
|
95 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSetLink; |
|
95 | 96 |
import org.gvsig.tools.ToolsLocator; |
96 | 97 |
import org.gvsig.tools.task.TaskStatus; |
97 | 98 |
import org.slf4j.Logger; |
... | ... | |
140 | 141 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
141 | 142 |
*/ |
142 | 143 |
public class RequestThreadManager extends Thread { |
143 |
private TilePipe pipe = null; |
|
144 |
private ArrayList<Tile> tiles = null;
|
|
145 |
private WMTSStatus status = null; |
|
144 |
private TilePipe pipe = null;
|
|
145 |
private List<WMTSTile> tiles = null;
|
|
146 |
private WMTSStatus status = null;
|
|
146 | 147 |
|
147 |
public RequestThreadManager(TilePipe pipe, ArrayList<Tile> tiles, WMTSStatus status) {
|
|
148 |
public RequestThreadManager(TilePipe pipe, List<WMTSTile> tiles, WMTSStatus status) {
|
|
148 | 149 |
this.pipe = pipe; |
149 | 150 |
this.tiles = tiles; |
150 | 151 |
this.status = status; |
... | ... | |
152 | 153 |
|
153 | 154 |
public void run() { |
154 | 155 |
for (int i = 0; i < tiles.size(); i++) { |
155 |
Tile tile = tiles.get(i); |
|
156 |
WMTSTile tile = tiles.get(i);
|
|
156 | 157 |
WMTSStatus statusCopy = status.cloneStatus(); |
157 |
statusCopy.setTileRow(tile.row);
|
|
158 |
statusCopy.setTileCol(tile.col);
|
|
158 |
statusCopy.setTileRow(tile.getRow());
|
|
159 |
statusCopy.setTileCol(tile.getCol());
|
|
159 | 160 |
if (pipe.getSize() > TilePipe.NTHREADS_QUEUE) { |
160 | 161 |
try { |
161 | 162 |
synchronized (this) { |
... | ... | |
176 | 177 |
class RequestTileLauncher extends Thread { |
177 | 178 |
private TilePipe pipe = null; |
178 | 179 |
private WMTSStatus status = null; |
179 |
private Tile tile = null;
|
|
180 |
private WMTSTile tile = null;
|
|
180 | 181 |
|
181 |
public RequestTileLauncher(TilePipe pipe, WMTSStatus status, Tile tile) { |
|
182 |
public RequestTileLauncher(TilePipe pipe, WMTSStatus status, WMTSTile tile) {
|
|
182 | 183 |
this.pipe = pipe; |
183 | 184 |
this.status = status; |
184 | 185 |
this.tile = tile; |
... | ... | |
188 | 189 |
try { |
189 | 190 |
//File file = getConnector().getTile(status, null); |
190 | 191 |
URL url = getConnector().getTileURL(status); |
191 |
tile.file = getConnector().downloadFile(url, null);
|
|
192 |
tile.setFile(getConnector().downloadFile(url, null));
|
|
192 | 193 |
pipe.setTile(tile); |
193 | 194 |
} catch (DownloadException e) { |
194 | 195 |
logger.info("Error downloading files", e); |
... | ... | |
323 | 324 |
* @param p |
324 | 325 |
* @return |
325 | 326 |
*/ |
326 |
@SuppressWarnings("unchecked") |
|
327 | 327 |
private boolean hasGridSubsets(WMTSDataParameters p) { |
328 |
ArrayList tileMatrixSetLimits = null;
|
|
329 |
ArrayList<?> tileMatrixSetLinkList = p.getLayer().getTileMatrixSetLink();
|
|
328 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = null;
|
|
329 |
List<WMTSTileMatrixSetLink> tileMatrixSetLinkList = p.getLayer().getTileMatrixSetLink();
|
|
330 | 330 |
String srs = p.getSRSCode(); |
331 | 331 |
for (int i = 0; i < tileMatrixSetLinkList.size(); i++) { |
332 | 332 |
WMTSTileMatrixSetLink tileMatrixSetLink = (WMTSTileMatrixSetLink)tileMatrixSetLinkList.get(i); |
333 | 333 |
WMTSTileMatrixSet tms = tileMatrixSetLink.getTileMatrixSet(); |
334 |
ArrayList tmsl = tileMatrixSetLink.getTileMatrixLimits();
|
|
334 |
List<WMTSTileMatrixLimits> tmsl = tileMatrixSetLink.getTileMatrixLimits();
|
|
335 | 335 |
String srsTileSet = tms.getSupportedCRS(); |
336 | 336 |
if(srsTileSet.compareTo(srs) == 0) { |
337 | 337 |
tileMatrixSetLimits = tmsl; |
... | ... | |
487 | 487 |
|
488 | 488 |
double widthMtsTile = 0; |
489 | 489 |
double heightMtsTile = 0; |
490 |
ArrayList<?> tileMatrixList = tileMatrixSet.getTileMatrix();
|
|
490 |
List<WMTSTileMatrix> tileMatrixList = tileMatrixSet.getTileMatrix();
|
|
491 | 491 |
extentByLevel = new ExtentImpl[tileMatrixList.size()]; |
492 | 492 |
double minX = 0; |
493 | 493 |
double minY = 0; |
... | ... | |
703 | 703 |
* @param level |
704 | 704 |
* @return |
705 | 705 |
*/ |
706 |
@SuppressWarnings("unchecked") |
|
707 | 706 |
private WMTSTileMatrix getTileMatrixByLevel(int level) { |
708 | 707 |
level = adjustLevel(level); |
709 | 708 |
|
710 | 709 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
711 | 710 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
712 |
ArrayList tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
711 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
713 | 712 |
|
714 | 713 |
WMTSTileMatrixLimits tileMatrixLimits = null; |
715 | 714 |
WMTSTileMatrix tileMatrix = (WMTSTileMatrix)tileMatrixSet.getTileMatrix().get(level); |
... | ... | |
724 | 723 |
* Returns the number of levels |
725 | 724 |
* @return |
726 | 725 |
*/ |
727 |
@SuppressWarnings("unchecked") |
|
728 | 726 |
public int getZoomLevels() { |
729 | 727 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
730 | 728 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
731 | 729 |
if(hasGridSubsets()) { |
732 |
ArrayList tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
730 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
733 | 731 |
return Math.min(tileMatrixSet.getTileMatrix().size(), tileMatrixSetLimits.size()); |
734 | 732 |
} |
735 | 733 |
return tileMatrixSet.getTileMatrix().size(); |
... | ... | |
831 | 829 |
//1-Selecci?n de WMTSTileMatrixSet por srs |
832 | 830 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
833 | 831 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
834 |
ArrayList<?> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
832 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
835 | 833 |
|
836 | 834 |
WMTSTileMatrix tileMatrix = (WMTSTileMatrix)tileMatrixSet.getTileMatrix().get(q.getResolutionLevel()); |
837 | 835 |
if(gridSubsets) { |
... | ... | |
846 | 844 |
WMTSStatus status = buildWMTSStatus(r, bufWidth , bufHeight); |
847 | 845 |
|
848 | 846 |
int[] size = str.getTileSizeByLevel(q.getResolutionLevel()); |
849 |
Tile tile = tileMatrix.new Tile(size[0], size[1], |
|
850 |
q.getTileRow(), q.getTileCol(), |
|
851 |
q.getBBox().getULX(), q.getBBox().getULY(), q.getBBox().getLRX(), q.getBBox().getLRY()); |
|
847 |
WMTSTile tile = WMTSOGCLocator.getManager().createTile( |
|
848 |
size, |
|
849 |
new int[]{q.getTileRow(), q.getTileCol()}, |
|
850 |
new double[]{q.getBBox().getULX(), q.getBBox().getULY(), q.getBBox().getLRX(), q.getBBox().getLRY()}); |
|
852 | 851 |
|
853 | 852 |
File file = getConnector().getTile(status, null); |
854 |
tile.file = file;
|
|
853 |
tile.setFile(file);
|
|
855 | 854 |
//Creamos un BandList con todas las bandas del fichero |
856 | 855 |
BandList bandList = new BandListImpl(); |
857 | 856 |
for(int i = 0; i < getBandCount(); i++) { |
858 | 857 |
try { |
859 | 858 |
DatasetBand band = new DatasetBandImpl(getURIOfFirstProvider(), i, getDataType()[i], getBandCount()); |
860 |
bandList.addBand(band, i);
|
|
859 |
bandList.addBand(band); |
|
861 | 860 |
} catch(BandNotFoundInListException e) { |
862 | 861 |
//No a?adimos la banda |
863 | 862 |
} |
... | ... | |
971 | 970 |
* @return An array with two elements. The first is the row and the second the column |
972 | 971 |
* of the tile in the tile matrix |
973 | 972 |
*/ |
974 |
@SuppressWarnings({ "unchecked"}) |
|
975 | 973 |
private void getTileInfo(PointInfo pointInfo) { |
976 | 974 |
WMTSDataParameters p = (WMTSDataParameters)param; |
977 | 975 |
|
978 | 976 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
979 | 977 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
980 |
ArrayList tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
978 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
981 | 979 |
|
982 | 980 |
WMTSTileMatrixLimits tileMatrixLimits = null; |
983 | 981 |
WMTSTileMatrix tileMatrix = (WMTSTileMatrix)tileMatrixSet.getTileMatrix().get(pointInfo.level); |
... | ... | |
986 | 984 |
tileMatrix = tileMatrixLimits.getTileMatrix(); |
987 | 985 |
} |
988 | 986 |
|
989 |
ArrayList<Tile> tiles = null;
|
|
987 |
List<WMTSTile> tiles = null;
|
|
990 | 988 |
if(hasGridSubsets()) |
991 | 989 |
tiles = tileMatrix.contains(p.isProjected(), tileMatrixLimits, pointInfo.worldCoord, getExtent().toRectangle2D()); |
992 | 990 |
else |
993 | 991 |
tiles = tileMatrix.contains(p.isProjected(), pointInfo.worldCoord, getExtent().toRectangle2D()); |
994 | 992 |
|
995 | 993 |
//Tile row and column |
996 |
pointInfo.tile = new Point2D.Double(tiles.get(0).row, tiles.get(0).col);
|
|
994 |
pointInfo.tile = new Point2D.Double(tiles.get(0).getRow(), tiles.get(0).getCol());
|
|
997 | 995 |
|
998 | 996 |
//Desplazamiento en pixels dentro del tile |
999 | 997 |
Point2D rasterPoint = tiles.get(0).worldToRaster(pointInfo.worldCoord); |
... | ... | |
1007 | 1005 |
* @return |
1008 | 1006 |
* @throws RasterDriverException |
1009 | 1007 |
*/ |
1010 |
@SuppressWarnings("unchecked") |
|
1011 | 1008 |
public WMTSStatus buildWMTSStatus(Rectangle2D r, int bufWidth, int bufHeight) throws RasterDriverException { |
1012 | 1009 |
WMTSDataParameters p = (WMTSDataParameters)param; |
1013 | 1010 |
|
... | ... | |
1022 | 1019 |
//1-Selecci?n de WMTSTileMatrixSet por srs |
1023 | 1020 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
1024 | 1021 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
1025 |
ArrayList tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
1022 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
1026 | 1023 |
int initialLevel = p.getLayer().getInitialLevel(tileMatrixSet.getIdentifier()); |
1027 | 1024 |
|
1028 | 1025 |
//Esto hace lo mismo que getScale y getLevelFromScale |
... | ... | |
1055 | 1052 |
tileMatrixLimits = (WMTSTileMatrixLimits)tileMatrixSetLimits.get(level - initialLevel - dif); |
1056 | 1053 |
|
1057 | 1054 |
//5-Selecci?n de tiles que entran en esta bounding box |
1058 |
ArrayList<Tile> tiles = null;
|
|
1055 |
List<WMTSTile> tiles = null;
|
|
1059 | 1056 |
/*if(gridSubsets) |
1060 | 1057 |
tiles = tileMatrix.intersects(p.isProjected(), tileMatrixLimits, r, getExtent().toRectangle2D()); |
1061 | 1058 |
else*/ |
... | ... | |
1063 | 1060 |
tiles = tileMatrix.intersects(p.isProjected(), r, extList[level].toRectangle2D()); |
1064 | 1061 |
|
1065 | 1062 |
//6-Petici?n |
1066 |
WMTSStatus status = new WMTSStatus(); |
|
1063 |
WMTSStatus status = null; |
|
1064 |
try { |
|
1065 |
status = getConnector().createStatus(); |
|
1066 |
} catch (WMTSException e) { |
|
1067 |
throw new RasterDriverException("Error creating WMTSStatus", e); |
|
1068 |
} |
|
1067 | 1069 |
status.setTileList(tiles); |
1068 | 1070 |
status.setLayer(p.getLayer().getIdentifier());//.substring(p.getLayer().getIdentifier().indexOf("_") + 1)); |
1069 | 1071 |
status.setFormat(p.getImageFormat()); |
... | ... | |
1123 | 1125 |
*/ |
1124 | 1126 |
public WMTSTileMatrixSetLink getTileMatrixSetLink() { |
1125 | 1127 |
WMTSDataParameters p = (WMTSDataParameters)param; |
1126 |
ArrayList<?> tileMatrixSetLinkList = p.getLayer().getTileMatrixSetLink();
|
|
1128 |
List<WMTSTileMatrixSetLink> tileMatrixSetLinkList = p.getLayer().getTileMatrixSetLink();
|
|
1127 | 1129 |
for (int i = 0; i < tileMatrixSetLinkList.size(); i++) { |
1128 | 1130 |
WMTSTileMatrixSetLink tileMatrixSetLink = (WMTSTileMatrixSetLink)tileMatrixSetLinkList.get(i); |
1129 | 1131 |
String srsTileSet = tileMatrixSetLink.getTileMatrixSet().getSupportedCRS(); |
... | ... | |
1160 | 1162 |
* @throws RasterDriverException |
1161 | 1163 |
* @throws ProcessInterruptedException |
1162 | 1164 |
*/ |
1163 |
@SuppressWarnings("unchecked") |
|
1164 | 1165 |
private synchronized org.gvsig.raster.cache.tile.Tile[] request( |
1165 | 1166 |
WMTSStatus status, BandList bandList, TileListener listener, int requestType) throws RasterDriverException, ProcessInterruptedException { |
1166 | 1167 |
//WMTSDataParameters p = (WMTSDataParameters)param; |
... | ... | |
1174 | 1175 |
if(connector == null) |
1175 | 1176 |
throw new RasterDriverException("Error getting the connector object"); |
1176 | 1177 |
|
1177 |
ArrayList<Tile> tiles = status.getTileList();
|
|
1178 |
List<WMTSTile> tiles = status.getTileList();
|
|
1178 | 1179 |
|
1179 | 1180 |
TilePipe pipe = new TilePipe(); |
1180 | 1181 |
//TilePipe2 pipe = new TilePipe2(); |
... | ... | |
1188 | 1189 |
//Caso 2: Lanza todos los threads |
1189 | 1190 |
} else if(requestType == UNLIMITED_THREADS) { |
1190 | 1191 |
for (int i = 0; i < tiles.size(); i++) { |
1191 |
Tile tile = tiles.get(i); |
|
1192 |
WMTSTile tile = tiles.get(i);
|
|
1192 | 1193 |
WMTSStatus statusCopy = status.cloneStatus(); |
1193 |
statusCopy.setTileRow(tile.row);
|
|
1194 |
statusCopy.setTileCol(tile.col);
|
|
1194 |
statusCopy.setTileRow(tile.getRow());
|
|
1195 |
statusCopy.setTileCol(tile.getCol());
|
|
1195 | 1196 |
new RequestTileLauncher(pipe, statusCopy, tile).start(); |
1196 | 1197 |
} |
1197 | 1198 |
} |
... | ... | |
1201 | 1202 |
if(requestType == LIMITED_THREADS || requestType == UNLIMITED_THREADS) { |
1202 | 1203 |
int nCollected = 0; |
1203 | 1204 |
while (nCollected < tiles.size()) { |
1204 |
Tile tile = pipe.getTile(); |
|
1205 |
WMTSTile tile = pipe.getTile();
|
|
1205 | 1206 |
tileList[nCollected] = drawTile(tile, listener, bandList); |
1206 | 1207 |
nCollected ++; |
1207 | 1208 |
} |
... | ... | |
1209 | 1210 |
|
1210 | 1211 |
if(requestType == SEQUENTIAL) { |
1211 | 1212 |
for (int i = 0; i < tiles.size(); i++) { |
1212 |
Tile tile = tiles.get(i); |
|
1213 |
status.setTileRow(tile.row);
|
|
1214 |
status.setTileCol(tile.col);
|
|
1213 |
WMTSTile tile = tiles.get(i);
|
|
1214 |
status.setTileRow(tile.getRow());
|
|
1215 |
status.setTileCol(tile.getCol());
|
|
1215 | 1216 |
//TODO:Cancelaci?n |
1216 | 1217 |
try { |
1217 | 1218 |
File file = connector.getTile(status, null); |
1218 |
tile.file = file;
|
|
1219 |
tile.setFile(file);
|
|
1219 | 1220 |
tileList[i] = drawTile(tile, listener, bandList); |
1220 | 1221 |
} catch (WMTSException e) { |
1221 | 1222 |
throw new RasterDriverException("Error getting tiles", e); |
... | ... | |
1238 | 1239 |
* @return |
1239 | 1240 |
* @throws RasterDriverException |
1240 | 1241 |
*/ |
1241 |
private synchronized org.gvsig.raster.cache.tile.Tile drawTile(Tile tile, TileListener listener, BandList bandList) throws RasterDriverException { |
|
1242 |
private synchronized org.gvsig.raster.cache.tile.Tile drawTile(WMTSTile tile, TileListener listener, BandList bandList) throws RasterDriverException {
|
|
1242 | 1243 |
WMTSDataParameters p = (WMTSDataParameters)param; |
1243 | 1244 |
try { |
1244 | 1245 |
String serverName = bandList.getBand(0).getFileName(); |
1245 | 1246 |
for (int j = 0; j < bandList.getBandCount(); j++) { |
1246 |
bandList.getBand(j).setFileName(tile.file.getPath());
|
|
1247 |
bandList.getBand(j).setFileName(tile.getFile().getPath());
|
|
1247 | 1248 |
} |
1248 | 1249 |
|
1249 |
DefaultRasterProvider driver = DefaultProviderServices.loadProvider(tile.file);
|
|
1250 |
DefaultRasterProvider driver = DefaultProviderServices.loadProvider(tile.getFile());
|
|
1250 | 1251 |
colorTable = driver.getColorTable(); |
1251 | 1252 |
bandCount = driver.getBandCount(); |
1252 | 1253 |
lastFileTransparency = (DataStoreTransparency)driver.getTransparency(); |
1253 |
Buffer rasterBuf = DefaultRasterManager.getInstance().createBuffer(getDataType()[0], tile.wPx, tile.hPx, 3, true); |
|
1254 |
Buffer rasterBuf = DefaultRasterManager.getInstance().createBuffer( |
|
1255 |
getDataType()[0], |
|
1256 |
tile.getWidthPx(), |
|
1257 |
tile.getHeightPx(), |
|
1258 |
3, |
|
1259 |
true); |
|
1254 | 1260 |
|
1255 | 1261 |
DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery(); |
1256 |
q.setAreaOfInterest(0, 0, tile.wPx, tile.hPx);
|
|
1262 |
q.setAreaOfInterest(0, 0, tile.getWidthPx(), tile.getHeightPx());
|
|
1257 | 1263 |
q.setBandList(bandList); |
1258 | 1264 |
q.setBuffer(rasterBuf); |
1259 | 1265 |
Buffer buf = driver.getDataSet(q); |
1260 | 1266 |
|
1261 |
buf.setDataExtent(new Rectangle2D.Double(Math.min(tile.ulx, tile.lrx), Math.min(tile.uly, tile.lry), Math.abs(tile.ulx - tile.lrx), Math.abs(tile.uly - tile.lry))); |
|
1267 |
buf.setDataExtent(new Rectangle2D.Double( |
|
1268 |
Math.min(tile.getULX(), tile.getLRX()), |
|
1269 |
Math.min(tile.getULY(), tile.getLRY()), |
|
1270 |
Math.abs(tile.getULX() - tile.getLRX()), |
|
1271 |
Math.abs(tile.getULY() - tile.getLRY()))); |
|
1262 | 1272 |
|
1263 | 1273 |
Buffer alphaBand = null; |
1264 | 1274 |
if(p.getAlphaBand() != -1 && listener != null && p.getAlphaBand() < bandCount) { |
1265 |
alphaBand = DefaultRasterManager.getInstance().createBuffer(getDataType()[0], tile.wPx, tile.hPx, 1, true); |
|
1275 |
alphaBand = DefaultRasterManager.getInstance().createBuffer( |
|
1276 |
getDataType()[0], |
|
1277 |
tile.getWidthPx(), |
|
1278 |
tile.getHeightPx(), |
|
1279 |
1, |
|
1280 |
true); |
|
1266 | 1281 |
int[] oldDB = bandList.getDrawableBands(); |
1267 | 1282 |
bandList.setDrawableBands(new int[]{p.getAlphaBand()}); |
1268 | 1283 |
q.setBandList(bandList); |
... | ... | |
1279 | 1294 |
|
1280 | 1295 |
|
1281 | 1296 |
TileCacheManager m = TileCacheLocator.getManager(); |
1282 |
org.gvsig.raster.cache.tile.Tile t = m.createTile(-1, tile.row, tile.col);
|
|
1297 |
org.gvsig.raster.cache.tile.Tile t = m.createTile(-1, tile.getRow(), tile.getCol());
|
|
1283 | 1298 |
t.setData(new Object[]{buf, alphaBand}); |
1284 |
t.setUl(new Point2D.Double(tile.ulx, tile.uly));
|
|
1285 |
t.setLr(new Point2D.Double(tile.lrx, tile.lry));
|
|
1299 |
t.setUl(new Point2D.Double(tile.getULX(), tile.getULY()));
|
|
1300 |
t.setLr(new Point2D.Double(tile.getLRX(), tile.getLRY()));
|
|
1286 | 1301 |
t.setDownloaderParams("AffineTransform", getAffineTransform()); |
1287 | 1302 |
t.setDownloaderParams("Tiling", new Boolean(true)); |
1288 | 1303 |
if(listener != null) |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSDataParameters.java | ||
---|---|---|
27 | 27 |
import org.cresques.cts.IProjection; |
28 | 28 |
import org.gvsig.compat.net.ICancellable; |
29 | 29 |
import org.gvsig.fmap.dal.coverage.store.parameter.RemoteStoreParameters; |
30 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer;
|
|
31 |
import org.gvsig.remoteclient.wmts.struct.WMTSStyle;
|
|
30 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer;
|
|
31 |
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle;
|
|
32 | 32 |
|
33 | 33 |
/** |
34 | 34 |
* Parameters for the WMTS provider |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSDataParametersImpl.java | ||
---|---|---|
29 | 29 |
import org.gvsig.compat.net.ICancellable; |
30 | 30 |
import org.gvsig.fmap.crs.CRSFactory; |
31 | 31 |
import org.gvsig.raster.impl.store.AbstractRasterDataParameters; |
32 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer;
|
|
33 |
import org.gvsig.remoteclient.wmts.struct.WMTSStyle;
|
|
32 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer;
|
|
33 |
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle;
|
|
34 | 34 |
import org.gvsig.tools.ToolsLocator; |
35 | 35 |
import org.gvsig.tools.dataTypes.DataTypes; |
36 | 36 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
... | ... | |
41 | 41 |
import org.gvsig.tools.persistence.PersistenceManager; |
42 | 42 |
import org.gvsig.tools.persistence.PersistentState; |
43 | 43 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
44 |
import org.slf4j.LoggerFactory; |
|
44 | 45 |
|
45 | 46 |
/** |
46 | 47 |
* Parameters for the WMTS provider |
... | ... | |
319 | 320 |
public boolean isProjected() { |
320 | 321 |
IProjection proj = getSRS(); |
321 | 322 |
if(proj == null) |
322 |
return false; |
|
323 |
else |
|
324 |
return proj.isProjected(); |
|
323 |
return true; |
|
324 |
else { |
|
325 |
try { |
|
326 |
return proj.isProjected(); |
|
327 |
} catch (Exception e) { |
|
328 |
LoggerFactory.getLogger(WMTSDataParameters.class).debug("error in projection", e); |
|
329 |
return true; |
|
330 |
} |
|
331 |
} |
|
325 | 332 |
} |
326 | 333 |
|
327 | 334 |
public String getSRSID() { |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/TilePipe.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.raster.wmts.io; |
23 | 23 |
|
24 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix.Tile;
|
|
24 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTile;
|
|
25 | 25 |
|
26 | 26 |
/** |
27 | 27 |
* This class manages transactions between the producer and the consumer. The |
... | ... | |
38 | 38 |
//dormir hasta que getTile lo despierte. |
39 | 39 |
private final static int BUFFER_SIZE = 10; |
40 | 40 |
|
41 |
private Tile buffer[] = new Tile[BUFFER_SIZE];
|
|
41 |
private WMTSTile buffer[] = new WMTSTile[BUFFER_SIZE];
|
|
42 | 42 |
private int next = 0; |
43 | 43 |
private boolean isFull = false; |
44 | 44 |
private boolean isEmpty = true; |
... | ... | |
56 | 56 |
* Sets a tile in the pipe |
57 | 57 |
* @param tile |
58 | 58 |
*/ |
59 |
public synchronized void setTile(Tile tile) { |
|
59 |
public synchronized void setTile(WMTSTile tile) {
|
|
60 | 60 |
while( isFull == true ) { |
61 | 61 |
try { |
62 | 62 |
wait(); |
... | ... | |
75 | 75 |
* Gets a tile from the pipe |
76 | 76 |
* @return |
77 | 77 |
*/ |
78 |
public synchronized Tile getTile() { |
|
78 |
public synchronized WMTSTile getTile() {
|
|
79 | 79 |
while( isEmpty == true ) { |
80 | 80 |
try { |
81 | 81 |
wait(); |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/downloader/TileDownloaderForWMTS.java | ||
---|---|---|
33 | 33 |
import org.gvsig.raster.wmts.io.WMTSConnector; |
34 | 34 |
import org.gvsig.raster.wmts.io.WMTSDataParameters; |
35 | 35 |
import org.gvsig.raster.wmts.io.WMTSProvider; |
36 |
import org.gvsig.remoteclient.exceptions.ServerErrorException;
|
|
37 |
import org.gvsig.remoteclient.wmts.WMTSStatus;
|
|
38 |
import org.gvsig.remoteclient.wmts.exception.WMTSException;
|
|
36 |
import org.gvsig.raster.wmts.ogc.WMTSStatus;
|
|
37 |
import org.gvsig.raster.wmts.ogc.exception.ServerErrorException;
|
|
38 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException;
|
|
39 | 39 |
|
40 | 40 |
/** |
41 | 41 |
* Tile getter |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/downloader/WMTSTileServer.java | ||
---|---|---|
25 | 25 |
import org.gvsig.raster.cache.tile.provider.Downloader; |
26 | 26 |
import org.gvsig.raster.cache.tile.provider.TileServer; |
27 | 27 |
import org.gvsig.raster.wmts.io.WMTSProvider; |
28 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix;
|
|
29 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSetLink;
|
|
28 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrix;
|
|
29 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSetLink;
|
|
30 | 30 |
|
31 | 31 |
/** |
32 | 32 |
* Data server for the tile cache in a WMTSProvider |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/downloader/WMTSCacheStruct.java | ||
---|---|---|
24 | 24 |
import java.awt.geom.Point2D; |
25 | 25 |
import java.awt.geom.Rectangle2D; |
26 | 26 |
import java.util.ArrayList; |
27 |
import java.util.List; |
|
27 | 28 |
|
28 | 29 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
29 | 30 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
... | ... | |
34 | 35 |
import org.gvsig.raster.cache.tile.provider.CacheStruct; |
35 | 36 |
import org.gvsig.raster.wmts.io.WMTSDataParameters; |
36 | 37 |
import org.gvsig.raster.wmts.io.WMTSProvider; |
37 |
import org.gvsig.remoteclient.wmts.WMTSStatus; |
|
38 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix; |
|
39 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixLimits; |
|
40 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSet; |
|
41 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSetLink; |
|
38 |
import org.gvsig.raster.wmts.ogc.WMTSStatus; |
|
39 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTile; |
|
40 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrix; |
|
41 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixLimits; |
|
42 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSet; |
|
43 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSetLink; |
|
42 | 44 |
|
43 | 45 |
/** |
44 | 46 |
* Implementation for a structure of a cache |
... | ... | |
48 | 50 |
private String layerName = null; |
49 | 51 |
private String serverURL = null; |
50 | 52 |
private WMTSTileMatrixSet tileMatrixSet = null; |
51 |
private ArrayList<?> tileMatrixSetLimits = null;
|
|
53 |
private List<WMTSTileMatrixLimits> tileMatrixSetLimits = null;
|
|
52 | 54 |
private double[] pixelSize = null; |
53 | 55 |
private WMTSProvider provider = null; |
54 | 56 |
|
... | ... | |
228 | 230 |
return tile; |
229 | 231 |
} |
230 | 232 |
|
231 |
/* |
|
232 |
* (non-Javadoc) |
|
233 |
* @see org.gvsig.raster.cache.tile.provider.CacheStruct#getTileList(java.awt.geom.Point2D, java.awt.geom.Point2D) |
|
234 |
*/ |
|
235 |
@SuppressWarnings("unchecked") |
|
236 |
public ArrayList<Tile> getTileList(Point2D ul, Point2D lr, double mtsPixelRequest) throws TileBuildException { |
|
233 |
public List<Tile> getTileList(Point2D ul, Point2D lr, double mtsPixelRequest) throws TileBuildException { |
|
237 | 234 |
Rectangle2D r = new Rectangle2D.Double(Math.min(ul.getX(), lr.getX()), |
238 | 235 |
Math.min(ul.getY(), lr.getY()), |
239 | 236 |
Math.abs(ul.getX() - lr.getX()), |
... | ... | |
244 | 241 |
WMTSStatus status = provider.buildWMTSStatus(r, bufWidth, bufHeight); |
245 | 242 |
|
246 | 243 |
//Conversi?n a tiles de la librer?a |
247 |
ArrayList<org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix.Tile> tiles = status.getTileList();
|
|
248 |
ArrayList<Tile> tileList = new ArrayList<Tile>();
|
|
244 |
List<WMTSTile> tiles = status.getTileList();
|
|
245 |
List<Tile> tileList = new ArrayList<Tile>(); |
|
249 | 246 |
for (int i = 0; i < tiles.size(); i++) { |
250 |
org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix.Tile tOrigin = (org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix.Tile) tiles.get(i);
|
|
251 |
Tile t = TileCacheLocator.getManager().createTile(status.getLevel(), tOrigin.col, tOrigin.row);
|
|
252 |
t.setUl(new Point2D.Double(tOrigin.ulx, tOrigin.uly));
|
|
253 |
t.setLr(new Point2D.Double(tOrigin.lrx, tOrigin.lry));
|
|
254 |
t.setWidthPx(tOrigin.wPx);
|
|
255 |
t.setHeightPx(tOrigin.hPx);
|
|
256 |
t.setDownloaderParams("WMTSStatus", provider.buildWMTSStatus(r, bufWidth, bufHeight));
|
|
247 |
WMTSTile tOrigin = (WMTSTile) tiles.get(i);
|
|
248 |
Tile t = TileCacheLocator.getManager().createTile(status.getLevel(), tOrigin.getCol(), tOrigin.getRow());
|
|
249 |
t.setUl(new Point2D.Double(tOrigin.getULX(), tOrigin.getULY()));
|
|
250 |
t.setLr(new Point2D.Double(tOrigin.getLRX(), tOrigin.getLRY()));
|
|
251 |
t.setWidthPx(tOrigin.getWidthPx());
|
|
252 |
t.setHeightPx(tOrigin.getHeightPx());
|
|
253 |
t.setDownloaderParams("WMTSStatus", status.cloneStatus());
|
|
257 | 254 |
tileList.add(t); |
258 | 255 |
} |
259 | 256 |
return tileList; |
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/pom.xml | ||
---|---|---|
51 | 51 |
</dependency> |
52 | 52 |
<dependency> |
53 | 53 |
<groupId>org.gvsig</groupId> |
54 |
<artifactId>org.gvsig.remoteclient</artifactId>
|
|
54 |
<artifactId>org.gvsig.projection</artifactId>
|
|
55 | 55 |
<scope>compile</scope> |
56 | 56 |
</dependency> |
57 | 57 |
<dependency> |
58 | 58 |
<groupId>org.gvsig</groupId> |
59 |
<artifactId>org.gvsig.projection</artifactId>
|
|
59 |
<artifactId>org.gvsig.compat</artifactId>
|
|
60 | 60 |
<scope>compile</scope> |
61 | 61 |
</dependency> |
62 | 62 |
<dependency> |
63 | 63 |
<groupId>org.gvsig</groupId> |
64 |
<artifactId>org.gvsig.compat</artifactId>
|
|
64 |
<artifactId>org.gvsig.fmap.geometry</artifactId>
|
|
65 | 65 |
<scope>compile</scope> |
66 | 66 |
</dependency> |
67 | 67 |
<dependency> |
68 | 68 |
<groupId>org.gvsig</groupId> |
69 |
<artifactId>org.gvsig.fmap.geometry</artifactId>
|
|
69 |
<artifactId>org.gvsig.raster.wmts.ogc.api</artifactId>
|
|
70 | 70 |
<scope>compile</scope> |
71 | 71 |
</dependency> |
72 |
<dependency> |
|
73 |
<groupId>org.gvsig</groupId> |
|
74 |
<artifactId>org.gvsig.raster.wmts.ogc.impl</artifactId> |
|
75 |
<scope>runtime</scope> |
|
76 |
</dependency> |
|
72 | 77 |
<!--<dependency> |
73 | 78 |
<groupId>org.gvsig</groupId> |
74 | 79 |
<artifactId>org.gvsig.jecw</artifactId> |
Also available in: Unified diff