Revision 4439 org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.io/src/main/java/org/gvsig/raster/wms/io/WMSServerExplorerParameters.java
WMSServerExplorerParameters.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.raster.wms.io; |
29 | 29 |
|
30 |
import org.slf4j.Logger; |
|
31 |
import org.slf4j.LoggerFactory; |
|
32 |
|
|
30 | 33 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
31 | 34 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
32 | 35 |
import org.gvsig.raster.impl.store.AbstractRasterDataParameters; |
... | ... | |
35 | 38 |
import org.gvsig.tools.dynobject.DynClass; |
36 | 39 |
import org.gvsig.tools.dynobject.DynStruct; |
37 | 40 |
import org.gvsig.tools.persistence.PersistenceManager; |
41 |
import org.gvsig.tools.persistence.PersistentState; |
|
42 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
38 | 43 |
|
39 | 44 |
/** |
40 | 45 |
* Parameters for the WMS provider |
... | ... | |
44 | 49 |
protected static final String FIELD_HOST = "host"; |
45 | 50 |
protected static DynClass DYNCLASS = null; |
46 | 51 |
private DelegatedDynObject delegatedDynObject = null; |
47 |
private static final String FIELD_XYAXISORDER = "xyaxisorder"; |
|
48 |
|
|
52 |
private static final String FIELD_XYAXISORDER = "xyaxisorder"; |
|
53 |
private static final String OLD_FIELD_AXISORDER = "axisorder"; |
|
54 |
|
|
55 |
@SuppressWarnings("unused") |
|
56 |
private static final Logger logger = LoggerFactory.getLogger(WMSServerExplorerParameters.class); |
|
57 |
|
|
58 |
/** |
|
59 |
* |
|
60 |
*/ |
|
49 | 61 |
public WMSServerExplorerParameters() { |
50 | 62 |
super(); |
51 | 63 |
initialize(); |
... | ... | |
56 | 68 |
.getDynObjectManager().createDynObject( |
57 | 69 |
registerDynClass()); |
58 | 70 |
} |
59 |
|
|
71 |
|
|
72 |
/** |
|
73 |
* @return the dynstruct |
|
74 |
*/ |
|
60 | 75 |
public static DynStruct registerDynClass() { |
61 | 76 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
62 | 77 |
DynStruct definition = manager.getDefinition("WMSServerExplorerParameters_Persistent"); |
... | ... | |
65 | 80 |
WMSServerExplorerParameters.class, |
66 | 81 |
"WMSServerExplorerParameters_Persistent", |
67 | 82 |
"WMS Explorer DataParameters Persistency", |
68 |
null,
|
|
83 |
null, |
|
69 | 84 |
null |
70 | 85 |
); |
71 | 86 |
} |
... | ... | |
74 | 89 |
|
75 | 90 |
definition.addDynFieldBoolean(FIELD_XYAXISORDER) |
76 | 91 |
.setDescription("Longitude first in axis order") |
77 |
.setMandatory(false); |
|
92 |
.setMandatory(false).setDefaultFieldValue(new Boolean(false));
|
|
78 | 93 |
|
79 | 94 |
definition.addDynFieldString(FIELD_HOST) |
80 | 95 |
.setDescription("Uniform Resource Identifier (File name or URL)") |
81 |
.setMandatory(false);
|
|
96 |
.setMandatory(false); |
|
82 | 97 |
return definition; |
83 | 98 |
} |
84 |
|
|
99 |
|
|
85 | 100 |
protected DelegatedDynObject getDelegatedDynObject() { |
86 | 101 |
return delegatedDynObject; |
87 | 102 |
} |
88 |
|
|
103 |
|
|
89 | 104 |
/** |
90 | 105 |
* Gets the assigned host |
91 |
* @return |
|
106 |
* @return the value of host field
|
|
92 | 107 |
*/ |
93 | 108 |
public String getHost() { |
94 | 109 |
return (String) this.getDynValue(FIELD_HOST); |
... | ... | |
102 | 117 |
this.setDynValue(FIELD_HOST, host); |
103 | 118 |
} |
104 | 119 |
|
120 |
/** |
|
121 |
* @return the provider name |
|
122 |
*/ |
|
105 | 123 |
public String getDataStoreName() { |
106 | 124 |
return WMSProvider.NAME; |
107 | 125 |
} |
108 |
|
|
126 |
|
|
127 |
/** |
|
128 |
* @return the provider description |
|
129 |
*/ |
|
109 | 130 |
public String getDescription() { |
110 | 131 |
return WMSProvider.DESCRIPTION; |
111 | 132 |
} |
... | ... | |
116 | 137 |
|
117 | 138 |
/** |
118 | 139 |
* <p>Gets the behaviour of the WMS client with regards the axis order</p> |
119 |
*
|
|
140 |
* |
|
120 | 141 |
* <p>Returns <code>true</code> if the WMS parser should assume that the |
121 | 142 |
* order of the coordinates follows the XY axis order |
122 | 143 |
* (the first coordinate corresponds to the horizontal X |
123 | 144 |
* axis, while the second coordinate corresponds to the |
124 | 145 |
* vertical Y axis), regardless the protocol version and CRS in use.</p> |
125 |
*
|
|
146 |
* |
|
126 | 147 |
* <p>Returns <code>false</code> if the WMS parser should decide the |
127 | 148 |
* axis order based on the protocol version and the coordinate |
128 | 149 |
* reference system (CRS) in use. In particular, if protocol |
129 | 150 |
* version is >= 1.3.0, then the WMS parser assumes |
130 | 151 |
* the axis order defined in the official EPSG registry for the |
131 | 152 |
* CRS in use. For versions < 1.3.0, the XY axis order is assumed.</p> |
132 |
*
|
|
153 |
* |
|
133 | 154 |
* <p>The default value is <code>false</code></p>. |
134 | 155 |
* @see #setXyAxisOrder(boolean) |
135 |
* @return |
|
156 |
* @return true if axis order is x-y
|
|
136 | 157 |
*/ |
137 | 158 |
public boolean isXyAxisOrder() { |
138 | 159 |
if (hasDynValue(FIELD_XYAXISORDER)) { |
... | ... | |
153 | 174 |
|
154 | 175 |
/** |
155 | 176 |
* <p>Sets the behaviour of the WMS client with regards the axis order.<p> |
156 |
*
|
|
177 |
* |
|
157 | 178 |
* <p>If set to <code>true</code>, then the XY axis order |
158 | 179 |
* is assumed for all the WMS |
159 | 180 |
* protocol versions and coordinate reference systems.</p> |
160 |
*
|
|
181 |
* |
|
161 | 182 |
* <p>If set to <code>false</code> |
162 | 183 |
* then the WMS parser will decide the axis order based on |
163 | 184 |
* the protocol version and the coordinate reference system (CRS) |
... | ... | |
165 | 186 |
* version is >= 1.3.0, then the WMS parser assumes |
166 | 187 |
* the axis order defined in the official EPSG registry for the |
167 | 188 |
* CRS in use. For versions < 1.3.0, the XY axis order is assumed.</p> |
168 |
*
|
|
169 |
*
|
|
189 |
* |
|
190 |
* |
|
170 | 191 |
* @param assumeXY |
171 | 192 |
* @see #isXyAxisOrder() |
172 | 193 |
*/ |
173 | 194 |
public void setXyAxisOrder(boolean assumeXY) { |
174 | 195 |
this.setDynValue(FIELD_XYAXISORDER, new Boolean(assumeXY)); |
175 | 196 |
} |
197 |
|
|
198 |
|
|
199 |
public void loadFromState(PersistentState state) throws PersistenceException { |
|
200 |
super.loadFromState(state); |
|
201 |
|
|
202 |
// Entre la 2.1 y la 2.2 cambi? la clave de la propiedad axisorder a xyaxisorder |
|
203 |
// El siguiente bloque try catch es para mantener compatibilidad con los proyectos de ambas versiones |
|
204 |
try { |
|
205 |
setDynValue(FIELD_XYAXISORDER, state.get(OLD_FIELD_AXISORDER)); |
|
206 |
} catch(Throwable t){ |
|
207 |
//do nothing; |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
|
|
212 |
public void setDynValue(String name, Object value) { |
|
213 |
if (OLD_FIELD_AXISORDER.equalsIgnoreCase(name)) { |
|
214 |
super.setDynValue(FIELD_XYAXISORDER, value); |
|
215 |
} else { |
|
216 |
super.setDynValue(name, value); |
|
217 |
} |
|
218 |
} |
|
176 | 219 |
} |
Also available in: Unified diff