wms_patch.diff
| src/org/gvsig/crs/ICrs.java (working copy) | ||
|---|---|---|
| 58 | 58 |
* @return |
| 59 | 59 |
*/ |
| 60 | 60 |
int getCode(); |
| 61 |
/** |
|
| 62 |
* Cadena WKT del CRS utilizado |
|
| 63 |
* @return |
|
| 64 |
*/ |
|
| 65 |
String getWKT(); |
|
| 66 | 61 |
|
| 67 | 62 |
/** |
| 68 | 63 |
* Devuelve la cadena con el par?metro nadgrid para proj4 |
| src/org/gvsig/remoteClient/wms/WMSProtocolHandler.java (working copy) | ||
|---|---|---|
| 669 | 669 |
public String getPartialQuery(WMSStatus status) |
| 670 | 670 |
{
|
| 671 | 671 |
StringBuffer req = new StringBuffer(); |
| 672 |
req.append("LAYERS=" + Utilities.Vector2CS(status.getLayerNames()))
|
|
| 673 |
.append("&" + getSRSParameter() + "=" + status.getSrs())
|
|
| 674 |
.append("&BBOX=" + status.getExtent().getMinX()+ "," )
|
|
| 675 |
.append(status.getExtent().getMinY()+ ",") |
|
| 676 |
.append(status.getExtent().getMaxX()+ ",") |
|
| 677 |
.append(status.getExtent().getMaxY()) |
|
| 678 |
.append("&WIDTH=" + status.getWidth())
|
|
| 679 |
.append("&HEIGHT=" + status.getHeight())
|
|
| 680 |
.append("&FORMAT=" + status.getFormat())
|
|
| 672 |
req.append("LAYERS=")
|
|
| 673 |
.append(Utilities.Vector2CS(status.getLayerNames())) |
|
| 674 |
.append("&").append(getSRSParameter()).append("=").append(status.getSrs());
|
|
| 675 |
|
|
| 676 |
appendBoundingBox(status, req); |
|
| 677 |
req.append("&WIDTH=").append(status.getWidth())
|
|
| 678 |
.append("&HEIGHT=").append(status.getHeight())
|
|
| 679 |
.append("&FORMAT=").append(status.getFormat())
|
|
| 681 | 680 |
.append("&STYLES=");
|
| 682 | 681 |
Vector v = status.getStyles(); |
| 683 | 682 |
if (v!=null && v.size()>0) |
| 684 | 683 |
req.append(Utilities.Vector2CS(v)); |
| 685 | 684 |
v = status.getDimensions(); |
| 686 | 685 |
if (v!=null && v.size()>0) |
| 687 |
req.append("&" + Utilities.Vector2URLParamString(v));
|
|
| 686 |
req.append("&").append(Utilities.Vector2URLParamString(v));
|
|
| 688 | 687 |
if (status.getTransparency()) {
|
| 689 | 688 |
req.append("&TRANSPARENT=TRUE");
|
| 690 | 689 |
} |
| ... | ... | |
| 701 | 700 |
public void close() {
|
| 702 | 701 |
// your code here |
| 703 | 702 |
} |
| 703 |
|
|
| 704 |
protected StringBuffer appendBoundingBox(WMSStatus status, StringBuffer req) {
|
|
| 705 |
req.append("&BBOX=")
|
|
| 706 |
.append(status.getExtent().getMinX()).append(",")
|
|
| 707 |
.append(status.getExtent().getMinY()).append(",")
|
|
| 708 |
.append(status.getExtent().getMaxX()).append(",")
|
|
| 709 |
.append(status.getExtent().getMaxY()); |
|
| 710 |
return req; |
|
| 711 |
} |
|
| 704 | 712 | |
| 705 | 713 |
/** |
| 706 | 714 |
* Inner class that represents the description of the WMS metadata. |
| src/org/gvsig/remoteClient/wms/wms_1_3_0/WMSProtocolHandler1_3_0.java (working copy) | ||
|---|---|---|
| 533 | 533 |
protected String getSRSParameter(){
|
| 534 | 534 |
return "CRS"; |
| 535 | 535 |
} |
| 536 |
|
|
| 537 |
/* |
|
| 538 |
* (non-Javadoc) |
|
| 539 |
* @see org.gvsig.remoteClient.wms.WMSProtocolHandler#getBoundingBox() |
|
| 540 |
*/ |
|
| 541 |
protected StringBuffer appendBoundingBox(WMSStatus status, StringBuffer req) {
|
|
| 542 |
if (status.getCrsAxisOrder()==WMSStatus.CRS_AXIS_NORTH_EAST) {
|
|
| 543 |
// We should check whether we should also reverse the bounding box for other orientations |
|
| 544 |
// (such as WMSStatus.CRS_AXIS_SOUTH_WEST), but it is difficult to get test cases. |
|
| 545 |
// For the moment we are conservative and will only reverse when order is CRS_AXIS_NORTH_EAST. |
|
| 546 |
req.append("&BBOX=")
|
|
| 547 |
.append(status.getExtent().getMinY()).append(",")
|
|
| 548 |
.append(status.getExtent().getMinX()).append(",")
|
|
| 549 |
.append(status.getExtent().getMaxY()).append(",")
|
|
| 550 |
.append(status.getExtent().getMaxX()); |
|
| 551 |
return req; |
|
| 552 |
} |
|
| 553 |
else {
|
|
| 554 |
return super.appendBoundingBox(status, req); |
|
| 555 |
} |
|
| 556 |
} |
|
| 536 | 557 |
} |
| src/org/gvsig/remoteClient/wms/WMSStatus.java (working copy) | ||
|---|---|---|
| 23 | 23 |
private boolean transparency; |
| 24 | 24 |
private String onlineResource; |
| 25 | 25 |
private String infoFormat; |
| 26 |
/* On WMS 1.3 we need to order the bounding box depending on the defined CRS axis order */ |
|
| 27 |
private int crsAxisOrder; |
|
| 26 | 28 |
|
| 29 |
public static final int CRS_AXIS_NORTH_EAST = 0; |
|
| 30 |
public static final int CRS_AXIS_EAST_NORTH = 1; |
|
| 31 |
public static final int CRS_AXIS_SOUTH_WEST = 2; |
|
| 32 |
public static final int CRS_AXIS_WEST_SOUTH = 3; |
|
| 33 |
public static final int CRS_AXIS_OTHER_OR_UNKNOWN = 4; |
|
| 34 |
|
|
| 27 | 35 |
public String getInfoFormat() {
|
| 28 | 36 |
return infoFormat; |
| 29 | 37 |
} |
| ... | ... | |
| 265 | 273 |
public void setOnlineResource(String url) {
|
| 266 | 274 |
onlineResource = url; |
| 267 | 275 |
} |
| 276 |
|
|
| 277 |
/** |
|
| 278 |
* Returns the axis order as specified by the CRS, as this defines the |
|
| 279 |
* order of the bounding box parameters on WMS 1.3. |
|
| 280 |
* |
|
| 281 |
* Valid values include: {@link #CRS_AXIS_EAST_NORTH},
|
|
| 282 |
* {@link #CRS_AXIS_NORTH_EAST}, {@link #CRS_AXIS_SOUTH_WEST},
|
|
| 283 |
* {@link #CRS_AXIS_WEST_SOUTH}, {@link #CRS_AXIS_OTHER_OR_UNKNOWN}.
|
|
| 284 |
*/ |
|
| 285 |
public int getCrsAxisOrder() {
|
|
| 286 |
return crsAxisOrder; |
|
| 287 |
} |
|
| 288 |
|
|
| 289 |
/** |
|
| 290 |
* Sets the axis order as specified by the CRS, as this defines the |
|
| 291 |
* order of the bounding box parameters on WMS 1.3. |
|
| 292 |
* |
|
| 293 |
* Valid values include: {@link #CRS_AXIS_EAST_NORTH},
|
|
| 294 |
* {@link #CRS_AXIS_NORTH_EAST}, {@link #CRS_AXIS_SOUTH_WEST},
|
|
| 295 |
* {@link #CRS_AXIS_WEST_SOUTH}, {@link #CRS_AXIS_OTHER_OR_UNKNOWN}.
|
|
| 296 |
*/ |
|
| 297 |
public void setCrsAxisOrder(int axisOrder) {
|
|
| 298 |
this.crsAxisOrder = axisOrder; |
|
| 299 |
} |
|
| 268 | 300 |
} |
| src/com/iver/cit/gvsig/fmap/layers/FLyrWMS.java (working copy) | ||
|---|---|---|
| 67 | 67 |
import java.util.Vector; |
| 68 | 68 |
import java.util.logging.Logger; |
| 69 | 69 |
import java.util.prefs.Preferences; |
| 70 |
import java.util.regex.Matcher; |
|
| 71 |
import java.util.regex.Pattern; |
|
| 70 | 72 | |
| 71 | 73 |
import javax.print.attribute.PrintRequestAttributeSet; |
| 72 | 74 |
import javax.swing.ImageIcon; |
| 73 | 75 |
import javax.swing.JOptionPane; |
| 74 | 76 | |
| 77 |
import org.cresques.cts.IProjection; |
|
| 75 | 78 |
import org.cresques.geo.ViewPortData; |
| 76 | 79 |
import org.cresques.px.Extent; |
| 77 | 80 |
import org.exolab.castor.xml.ValidationException; |
| ... | ... | |
| 194 | 197 |
private int lastNColumns = 0; |
| 195 | 198 |
private int lastNRows = 0; |
| 196 | 199 |
private boolean hasImageLegend = false; |
| 200 |
|
|
| 201 |
private int cachedAxisOrientation = WMSStatus.CRS_AXIS_OTHER_OR_UNKNOWN; |
|
| 197 | 202 | |
| 198 | 203 |
/*** |
| 199 | 204 |
* WMS 1.3 standard defines a fixed pixel size of 0.28 mm for the server. |
| ... | ... | |
| 677 | 682 |
wmsStatus.setFormat( m_Format ); |
| 678 | 683 |
wmsStatus.setLayerNames(Utilities.createVector(layerQuery,",")); |
| 679 | 684 |
wmsStatus.setSrs(m_SRS); |
| 685 |
wmsStatus.setCrsAxisOrder(cachedAxisOrientation); |
|
| 680 | 686 |
wmsStatus.setStyles(styles); |
| 681 | 687 |
wmsStatus.setDimensions(dimensions); |
| 682 | 688 |
wmsStatus.setTransparency(wmsTransparency); |
| 683 |
wmsStatus.setSrs(m_SRS); |
|
| 684 | 689 |
MyCancellable c = new MyCancellable(cancellable); |
| 685 | 690 |
try {
|
| 686 | 691 |
item[0] = new StringXMLItem(new String(getDriver() |
| ... | ... | |
| 935 | 940 |
wmsStatus.setWidth( fixedSize.width ); |
| 936 | 941 |
wmsStatus.setLayerNames(Utilities.createVector(layerQuery,",")); |
| 937 | 942 |
wmsStatus.setSrs(m_SRS); |
| 943 |
wmsStatus.setCrsAxisOrder(cachedAxisOrientation); |
|
| 938 | 944 |
wmsStatus.setStyles(styles); |
| 939 | 945 |
wmsStatus.setDimensions(dimensions); |
| 940 | 946 |
wmsStatus.setTransparency(wmsTransparency); |
| ... | ... | |
| 1196 | 1202 |
wmsStatus.setWidth( wImg ); |
| 1197 | 1203 |
wmsStatus.setLayerNames(Utilities.createVector(layerQuery,",")); |
| 1198 | 1204 |
wmsStatus.setSrs(m_SRS); |
| 1205 |
wmsStatus.setCrsAxisOrder(cachedAxisOrientation); |
|
| 1199 | 1206 |
wmsStatus.setStyles(styles); |
| 1200 | 1207 |
wmsStatus.setDimensions(dimensions); |
| 1201 | 1208 |
wmsStatus.setTransparency(wmsTransparency); |
| ... | ... | |
| 2294 | 2301 |
return null; |
| 2295 | 2302 |
} |
| 2296 | 2303 | |
| 2304 |
/** |
|
| 2305 |
* Try to guess the axis orientation from the CRS WKT definition, |
|
| 2306 |
* as there is no good way to do this using libProjection API. |
|
| 2307 |
* |
|
| 2308 |
* @return One of @link {@link WMSStatus#CRS_AXIS_EAST_NORTH},
|
|
| 2309 |
* {@link WMSStatus#CRS_AXIS_NORTH_EAST}, {@link WMSStatus#CRS_AXIS_SOUTH_WEST},
|
|
| 2310 |
* {@link WMSStatus#CRS_AXIS_WEST_SOUTH}, {@link WMSStatus#CRS_AXIS_OTHER_OR_UNKNOWN}.
|
|
| 2311 |
*/ |
|
| 2312 |
private int guessAxisOrientation() {
|
|
| 2313 |
if (this.getProjection()!=null) {
|
|
| 2314 |
String wkt = this.getProjection().getWKT(); |
|
| 2315 |
if (wkt!=null) {
|
|
| 2316 |
String wktup = wkt.toUpperCase(); |
|
| 2317 |
Pattern p = Pattern.compile(".*AXIS\\[(.*)\\]\\s*,\\s*AXIS\\[(.*)\\].*", Pattern.DOTALL);
|
|
| 2318 |
Matcher m = p.matcher(wkt); |
|
| 2319 |
if (m.matches()) {
|
|
| 2320 |
String firstAxis = m.group(1); |
|
| 2321 |
String secondAxis = m.group(2); |
|
| 2322 |
if (firstAxis.contains("EAST")
|
|
| 2323 |
&& secondAxis.contains("NORTH")) {
|
|
| 2324 |
return WMSStatus.CRS_AXIS_EAST_NORTH; |
|
| 2325 |
} |
|
| 2326 |
else if (firstAxis.contains("NORTH")
|
|
| 2327 |
&& secondAxis.contains("EAST")) {
|
|
| 2328 |
return WMSStatus.CRS_AXIS_NORTH_EAST; |
|
| 2329 |
} |
|
| 2330 |
else if (firstAxis.contains("WEST")
|
|
| 2331 |
&& secondAxis.contains("SOUTH")) {
|
|
| 2332 |
return WMSStatus.CRS_AXIS_WEST_SOUTH; |
|
| 2333 |
} |
|
| 2334 |
else if (firstAxis.contains("SOUTH")
|
|
| 2335 |
&& secondAxis.contains("WEST")) {
|
|
| 2336 |
return WMSStatus.CRS_AXIS_SOUTH_WEST; |
|
| 2337 |
} |
|
| 2338 |
} |
|
| 2339 |
} |
|
| 2340 |
} |
|
| 2341 |
return WMSStatus.CRS_AXIS_OTHER_OR_UNKNOWN; |
|
| 2342 |
} |
|
| 2343 |
|
|
| 2344 |
public void setProjection(IProjection proj) {
|
|
| 2345 |
super.setProjection(proj); |
|
| 2346 |
cachedAxisOrientation = guessAxisOrientation(); |
|
| 2347 |
} |
|
| 2297 | 2348 |
} |
| src/org/cresques/cts/IProjection.java (working copy) | ||
|---|---|---|
| 75 | 75 | |
| 76 | 76 |
public double getScale(double minX, double maxX, double width, double dpi); |
| 77 | 77 |
public Rectangle2D getExtent(Rectangle2D extent,double scale,double wImage,double hImage,double mapUnits,double distanceUnits,double dpi); |
| 78 |
|
|
| 79 |
/** |
|
| 80 |
* Returns the definition of this CRS as well-known-text format (WKT), if |
|
| 81 |
* available. Otherwise return null. |
|
| 82 |
*/ |
|
| 83 |
public String getWKT(); |
|
| 78 | 84 |
} |
| src/org/cresques/geo/Gauss.java (working copy) | ||
|---|---|---|
| 141 | 141 |
public String getFullCode() {
|
| 142 | 142 |
return getAbrev(); |
| 143 | 143 |
} |
| 144 |
|
|
| 145 |
/* |
|
| 146 |
* (non-Javadoc) |
|
| 147 |
* @see org.cresques.cts.IProjection#getWKT() |
|
| 148 |
*/ |
|
| 149 |
public String getWKT() {
|
|
| 150 |
// TODO Auto-generated method stub |
|
| 151 |
return null; |
|
| 152 |
} |
|
| 144 | 153 |
} |
| src/org/cresques/geo/Mercator.java (working copy) | ||
|---|---|---|
| 389 | 389 |
public String getFullCode() {
|
| 390 | 390 |
return getAbrev(); |
| 391 | 391 |
} |
| 392 |
|
|
| 393 |
/* |
|
| 394 |
* (non-Javadoc) |
|
| 395 |
* @see org.cresques.cts.IProjection#getWKT() |
|
| 396 |
*/ |
|
| 397 |
public String getWKT() {
|
|
| 398 |
// TODO Auto-generated method stub |
|
| 399 |
return null; |
|
| 400 |
} |
|
| 392 | 401 |
} |
| src/org/cresques/geo/CCLambert.java (working copy) | ||
|---|---|---|
| 141 | 141 |
public String getFullCode() {
|
| 142 | 142 |
return getAbrev(); |
| 143 | 143 |
} |
| 144 |
|
|
| 145 |
/* |
|
| 146 |
* (non-Javadoc) |
|
| 147 |
* @see org.cresques.cts.IProjection#getWKT() |
|
| 148 |
*/ |
|
| 149 |
public String getWKT() {
|
|
| 150 |
// TODO Auto-generated method stub |
|
| 151 |
return null; |
|
| 152 |
} |
|
| 144 | 153 |
} |
| src/org/cresques/geo/Geodetic.java (working copy) | ||
|---|---|---|
| 314 | 314 |
public String getFullCode() {
|
| 315 | 315 |
return getAbrev(); |
| 316 | 316 |
} |
| 317 | ||
| 318 |
/* |
|
| 319 |
* (non-Javadoc) |
|
| 320 |
* @see org.cresques.cts.IProjection#getWKT() |
|
| 321 |
*/ |
|
| 322 |
public String getWKT() {
|
|
| 323 |
// TODO Auto-generated method stub |
|
| 324 |
return null; |
|
| 325 |
} |
|
| 317 | 326 |
} |
| src/org/cresques/cts/gt2/CoordSys.java (working copy) | ||
|---|---|---|
| 218 | 218 |
public String getFullCode() {
|
| 219 | 219 |
return getAbrev(); |
| 220 | 220 |
} |
| 221 | ||
| 222 |
/* |
|
| 223 |
* (non-Javadoc) |
|
| 224 |
* @see org.cresques.cts.IProjection#getWKT() |
|
| 225 |
*/ |
|
| 226 |
public String getWKT() {
|
|
| 227 |
if (isProjected()) {
|
|
| 228 |
return projCS.toWKT(); |
|
| 229 |
} |
|
| 230 |
else {
|
|
| 231 |
return geogCS.toWKT(); |
|
| 232 |
} |
|
| 233 |
} |
|
| 221 | 234 |
} |
| src/org/cresques/geo/UtmZone.java (working copy) | ||
|---|---|---|
| 400 | 400 |
public String getFullCode() {
|
| 401 | 401 |
return getAbrev(); |
| 402 | 402 |
} |
| 403 |
|
|
| 404 |
/* |
|
| 405 |
* (non-Javadoc) |
|
| 406 |
* @see org.cresques.cts.IProjection#getWKT() |
|
| 407 |
*/ |
|
| 408 |
public String getWKT() {
|
|
| 409 |
// TODO Auto-generated method stub |
|
| 410 |
return null; |
|
| 411 |
} |
|
| 403 | 412 |
} |