Revision 14660

View differences:

org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.148/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/epsg/CrsAxisOrder.java
1
package org.gvsig.remoteclient.epsg;
2

  
3
import java.io.BufferedReader;
4
import java.io.IOException;
5
import java.io.InputStream;
6
import java.io.InputStreamReader;
7
import java.util.HashSet;
8

  
9
/**
10
 * <p>Utility class to get the axis order of a coordinate reference system (CRS).
11
 * It should be generalized and moved to the projection API on some future
12
 * version.</p>
13
 * 
14
 * @author Cesar Martinez Izquierdo
15
 *
16
 */
17
public class CrsAxisOrder {
18
	/*
19
	 * Set containing the EPSG codes for projections using Y-X axis order.
20
	 */
21
	private static HashSet<String> yxAxisOrder = null;
22
	
23
	/**
24
	 * Returns a set containing the EPSG codes for projections using Y-X axis
25
	 * order.
26
	 * 
27
	 * @return
28
	 */
29
	private static HashSet<String> getYxAxisOrder() {
30
		if (yxAxisOrder==null) {
31
			yxAxisOrder = new HashSet();
32
			try {
33
				InputStream is = CrsAxisOrder.class.getClassLoader().getResourceAsStream("/axisOrder/mapaxisorder.csv");
34
				if (is!=null) {
35
					BufferedReader reader = new BufferedReader(new InputStreamReader(is, "ISO-8859-1"));
36
					// skip the first line which contains the CSV header
37
					String line = reader.readLine();
38
					// read the codes
39
					while ((line=reader.readLine())!=null) {
40
						yxAxisOrder.add(line);
41
					}
42
				}
43
			} catch (IOException e) {
44
			}
45
		}
46
		return yxAxisOrder;
47
	}
48
	
49
	/**
50
	 * <p>Returns <code>true</code> if the CRS defined by the
51
	 * provided EPSG code follows the XY axis order (i.e.
52
	 * the first coordinate corresponds to the horizontal
53
	 * axis while the second coordinate corresponds to
54
	 * the vertical axis). Returns <false> if the
55
	 * EPSG registry defines YX order.</p>
56
	 * 
57
	 * <p>Note that it will also return true for any unknown CRS</p>.
58
	 * 
59
	 * @param epsgCode The EPSG code of the CRS to check, as integer.
60
	 * @return
61
	 */
62
	public static boolean isXyAxisOrder(int epsgCode) {
63
		if (getYxAxisOrder().contains(Integer.toString(epsgCode))) {
64
			return false;
65
		}
66
		return true;
67
	}
68

  
69
	/**
70
	 * <p>Returns <code>true</code> if the CRS defined by the
71
	 * provided EPSG code follows the XY axis order (i.e.
72
	 * the first coordinate corresponds to the horizontal
73
	 * axis while the second coordinate corresponds to
74
	 * the vertical axis). Returns <false> if the
75
	 * EPSG registry defines YX order.</p>
76
	 * 
77
	 * <p>Note that it will also return true for any unknown CRS</p>.
78
	 * 
79
	 * @param epsgCode Epsg code as string, for instance "EPSG:4326" or just
80
	 * "4326".
81
	 * @return
82
	 */
83
	public static boolean isXyAxisOrder(String epsgCode) {
84
		if (epsgCode!=null) {
85
			if (epsgCode.toUpperCase().startsWith("EPSG:")) {
86
				epsgCode = epsgCode.substring(5);
87
			}
88
			if (getYxAxisOrder().contains(epsgCode)) {
89
				return false;
90
			}
91
		}
92
		return true;
93
	}
94
}
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.148/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/exceptions/WMSException.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.exceptions;
25

  
26
/**
27
 * Excepci?n provocada por el WMS.
28
 *
29
 * @author Vicente Caballero Navarro
30
 */
31
public class WMSException extends Exception 
32
{	
33
	private String wms_message = null;
34
	
35
	/**
36
	 *
37
	 */
38
	public WMSException() {
39
		super();
40
	}
41

  
42
	/**
43
	 * Crea WMSException.
44
	 *
45
	 * @param message
46
	 */
47
	public WMSException(String message) {
48
		super(message);
49
	}
50

  
51
	/**
52
	 * Crea WMSException.
53
	 *
54
	 * @param message
55
	 * @param cause
56
	 */
57
	public WMSException(String message, Throwable cause) {
58
		super(message, cause);
59
	}
60

  
61
	/**
62
	  * Crea WMSException.
63
	 *
64
	 * @param cause
65
	 */
66
	public WMSException(Throwable cause) {
67
		super(cause);
68
	}
69
	
70
	public String getWMSMessage()
71
	{
72
		if (wms_message == null)
73
			return "";
74
		else
75
			return wms_message;
76
	}
77
	
78
	public void setWMSMessage(String mes)
79
	{
80
		wms_message = mes;
81
	}
82
}
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.148/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/exceptions/WMSWrongSizeException.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.exceptions;
25

  
26
/**
27
 * La petici?n al servidor era de un tama?o equivocado.
28
 * Reconoce execepciones de algunos tipos:<br>
29
 * <li>El server http://wms.jpl.nasa.gov/wms.cgi da estos:
30
 * <pre>
31
    <?xml version='1.0' encoding="UTF-8" standalone="no" ?>
32
	<!DOCTYPE ServiceExceptionReport SYSTEM "http://www.digitalearth.gov/wmt/xml/exception_1_1_0.dtd ">
33
	<ServiceExceptionReport version="1.1.0">
34
	  <ServiceException>
35
	    Requested image is too wide, max allowed width is 4096
36
	  </ServiceException>
37
	</ServiceExceptionReport>
38
	
39
	<?xml version='1.0' encoding="UTF-8" standalone="no" ?>
40
	<!DOCTYPE ServiceExceptionReport SYSTEM "http://www.digitalearth.gov/wmt/xml/exception_1_1_0.dtd ">
41
	<ServiceExceptionReport version="1.1.0">
42
	  <ServiceException>
43
	    Requested image is too tall, max allowed height is 4096
44
	  </ServiceException>
45
	</ServiceExceptionReport>
46
 * </pre>
47
 * <li>El server http://www.idee.es/wms/IDEE-Base/IDEE-Base da
48
 * <pre>
49
 	<ERROR Operation="GetMap Request" status="ERROR" source="Web Map Server" description="El servidor no ha podido realizar la operacion">
50
		<ERROR CODE="El tamano en pixels pedido no es valido."/>
51
		<ERROR CODE="Su valor debe ser mayor que 0 y menor que el limite de descarga: anchura = 1500, altura = 1500"/>
52
	</ERROR>
53
 * </pre>
54
 * <li>El server http://ovc.catastro.meh.es/Cartografia/WMS/ServidorWMS.aspx da
55
 * <pre>
56
 	<ServiceExceptionReport version="1.1.1">
57
-
58
	<ServiceException code="InvalidFormat">
59

  
60
Par?metros erroneos:
61
prefijo = 
62
mapa =  0
63
formato = IMAGE/JPEG
64
XMin =  1.1578804698593
65
YMin =  53.5852110737936
66
XMax =  10.3
67
YMax =  53.8000038968219
68
AnchoPixels =  64
69
AltoPixels =  5023
70
Transparente = TRUE
71
Descripci?n error:
72
AltoPixels > 2000
73
</ServiceException>
74
</ServiceExceptionReport>
75
 * </pre>
76
 * 
77
 * <pre>
78
 	<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
79
<!DOCTYPE ServiceExceptionReport SYSTEM "http://schemas.opengeospatial.net/wms/1.1.1/exception_1_1_1.dtd">
80
<ServiceExceptionReport version="1.1.1">
81
<ServiceException>
82
msWMSLoadGetMapParams(): WMS server error. Image size out of range, WIDTH and HEIGHT must be between 1 and 2048 pixels.
83
</ServiceException>
84
</ServiceExceptionReport>
85

  
86
 * </pre>
87
 * 
88
 */
89
public class WMSWrongSizeException extends WMSException 
90
{	
91
	private int height = -1;
92
	private int width = -1;
93
	
94
	/**
95
	 *
96
	 */
97
	public WMSWrongSizeException() {
98
		super();
99
	}
100

  
101
	/**
102
	 * Crea WMSException.
103
	 *
104
	 * @param message
105
	 */
106
	public WMSWrongSizeException(String message) {
107
		super(message);
108
	}
109

  
110
	/**
111
	 * Crea WMSException.
112
	 *
113
	 * @param message
114
	 * @param cause
115
	 */
116
	public WMSWrongSizeException(String message, Throwable cause) {
117
		super(message, cause);
118
	}
119

  
120
	/**
121
	  * Crea WMSException.
122
	 *
123
	 * @param cause
124
	 */
125
	public WMSWrongSizeException(Throwable cause) {
126
		super(cause);
127
	}
128
	
129
	public int getWidth()
130
	{
131
		return width; 
132
	}
133
	public int getHeight()
134
	{
135
		return height;
136
	}
137
	public void setWidth(int w)
138
	{
139
		width =w;
140
	}
141
	public void setHeight(int h)
142
	{
143
		height =h;
144
	}
145
	
146
	/**
147
	 * Checks if the argument is a WrongSizeError message, in this
148
	 * case throws a WMSWrongSizeException
149
	 * @param errorMsg El mensaje de error que pasa el server.
150
	 * @throws WMSException
151
	 */
152
	public static void check(String errorMsg) throws WMSException 
153
	{
154
		//TODO:
155
		//check the errorMsg to see if it matches with one of the 
156
		// well known string error messages.
157
	}
158
}
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.148/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/wms/WMSDimension.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
25
package org.gvsig.remoteclient.wms;
26

  
27
import java.io.IOException;
28

  
29
import org.kxml2.io.KXmlParser;
30
import org.xmlpull.v1.XmlPullParserException;
31

  
32
import org.gvsig.remoteclient.utils.CapabilitiesTags;
33

  
34
/**
35
 * <p></p>
36
 * 
37
 */
38
public class WMSDimension {
39
    
40
    private String name;
41
    private String units;
42
    private String unitSymbol;
43
    /**
44
     * Declares what value would be used along this dimension if a Web
45
     * request omits a value for this dimension.
46
     */
47
    private String dimDefaultValue;
48
    /**
49
     * Indicates that the request may include multiple values or
50
     * (if it is null or zero) have to include <b>only<b/> single 
51
     * value for this dimension. 
52
     */
53
    private String multipleValues;
54
    /**
55
     * Indicates that the server will round off inexact dimension values
56
     * to the nearest valid value, or (if it is null or zero) it will not.
57
     */
58
    private String nearestValues;
59
    /**
60
     * Indicates that temporal data are normally kept current and that the
61
     * request parameter TIME <b>may</b> include the keyword 'current' 
62
     * instead of an ending value. 
63
     */
64
    private String current;
65
    /**
66
     * cotains the expression for this dimension's extent.
67
     */
68
    private String extentExpression;
69
    private String extDefaultValue;
70

  
71
    private String dimensionExpression;
72
   
73
    public String getName() {        
74
        return name;
75
    } 
76
 
77
    public String getUnits() {        
78
        return units;
79
    }
80
  
81
    public String getUnitSymbol() {        
82
        return unitSymbol;
83
    } 
84
    
85
    /**
86
     * Tells that the temporal data are normally kept current and that
87
     * the request parameter TIME may include the keyword 'current'
88
     * instead of an ending value.
89
     *
90
     * @return <b>true</b> if the server does keep the data, <b>false</b> else.
91
     */
92
    public boolean allowsCurrentTime() {
93
        return (current!=null && !current.equals("0"));
94
    }
95
    
96
    
97
    /**
98
     * Gets the value that would be used along this dimension if a Web
99
     * request omits a value for the dimension.
100
     * 
101
     * @return Returns the defaultValue.
102
     */
103
    public String getDimDefaultValue() {
104
        return dimDefaultValue;
105
    }
106
    
107
    /**
108
     * Returns the extent expression as it was written in the Capabilities 
109
     * document.
110
     * @return String
111
     */
112
    public String getExtentExpression() {
113
        return extentExpression;
114
    }
115
    /**
116
     * @return Returns the multipleValues.
117
     */
118
    public boolean allowsMultipleValues() {
119
        return (multipleValues!=null && !multipleValues.equals("0"));
120
    }   
121
    
122
    
123
    /**
124
     * @return Returns the dimensionExpression.
125
     */
126
    public String getDimensionExpression() {
127
        return dimensionExpression;
128
    }
129
    
130
    public void setDimensionExpression(String exp) {
131
        dimensionExpression = exp;
132
    }
133

  
134
    /**
135
     * @return Returns the nearestValues.
136
     */
137
    public boolean allowsNearestValues() {
138
        return (nearestValues!=null && !nearestValues.equals("0"));
139
    }
140
    
141

  
142
    /**
143
     * Parses the DIMENSION tag in the WMS capabilities, filling the WMSDimension object
144
     * and loading the data into memory to be easily accesed
145
     */
146
    public void parse(KXmlParser parser) throws IOException, XmlPullParserException{
147
        parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.DIMENSION);
148
        name                = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_NAME);
149
        units               = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_UNITS);
150
        unitSymbol          = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_UNIT_SYMBOL);
151
        dimDefaultValue     = parser.getAttributeValue("", CapabilitiesTags.DEFAULT);
152
        dimensionExpression = parser.nextText(); 
153
    }
154
    
155
}
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.148/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/wms/WMSServiceInformation.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
 
25
package org.gvsig.remoteclient.wms;
26

  
27
import java.util.Vector;
28

  
29
import org.gvsig.remoteclient.ogc.OGCClientOperation;
30
import org.gvsig.remoteclient.ogc.OGCServiceInformation;
31
import org.gvsig.remoteclient.utils.CapabilitiesTags;
32

  
33
/**
34
 * Class that represents the description of the WMS metadata.
35
 * The first part of the capabilities will return the service information
36
 * from the WMS, this class will hold this information.
37
 * 
38
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
39
 */
40
public class WMSServiceInformation extends OGCServiceInformation{
41
	/*public String map_online_resource = null;
42
    public String feature_online_resource = null;*/
43
    public String version;
44
    public String name;
45
    public String scope;
46
    public String title;
47
    public String abstr;
48
    public String keywords;
49
    public String fees;
50
    public String operationsInfo;
51
    public String personname;
52
    public String organization;
53
    public String function;
54
    public String addresstype;
55
    public String address;
56
    public String place;
57
    public String province;
58
    public String postcode;
59
    public String country;
60
    public String phone;
61
    public String fax;
62
    public String email;
63
    public Vector formats;
64
    public Vector infoformats;
65

  
66
    public WMSServiceInformation()
67
    {
68
        version = new String();
69
        name = new String();
70
        scope = new String();
71
        title = new String();
72
        abstr = new String();
73
        keywords = new String();
74
        fees = new String();
75
        operationsInfo = new String();
76
        personname = new String();
77
        organization = new String();
78
        function = new String();
79
        addresstype = new String();
80
        address = new String();
81
        place = new String();
82
        province = new String();
83
        postcode = new String();
84
        country = new String();
85
        phone = new String();
86
        fax = new String();
87
        email = new String();
88
        formats = new Vector(); 
89
        infoformats = new Vector();
90
    }
91
    
92
    public boolean isQueryable()
93
    {
94
    	if (getOnlineResource(CapabilitiesTags.GETFEATUREINFO) != null)    	
95
    		return true;
96
    	else
97
    		return false;
98
    }
99
    
100
    public boolean hasLegendGraphic()
101
    {
102
    	if (getOnlineResource(CapabilitiesTags.GETLEGENDGRAPHIC) != null) 
103
    		return true;
104
    	else
105
    		return false;
106
    }
107
    
108
    public void clear() {
109
    	version = new String();
110
        name = new String();
111
        scope = new String();
112
        title = new String();
113
        abstr = new String();
114
        keywords = new String();
115
        fees = new String();
116
        operationsInfo = new String();
117
        personname = new String();
118
        organization = new String();
119
        function = new String();
120
        addresstype = new String();
121
        address = new String();
122
        place = new String();
123
        province = new String();
124
        postcode = new String();
125
        country = new String();
126
        phone = new String();
127
        fax = new String();
128
        email = new String();
129
        formats = new Vector();  
130
        infoformats = new Vector();
131
    }      
132
    
133
	/* (non-Javadoc)
134
	 * @see org.gvsig.remoteClient.ogc.OGCServiceInformation#createOperation(java.lang.String)
135
	 */	
136
	public OGCClientOperation createOperation(String name) {
137
		return new WMSOperation(name); 
138
	}
139

  
140
	/* (non-Javadoc)
141
	 * @see org.gvsig.remoteClient.ogc.OGCServiceInformation#createOperation(java.lang.String, java.lang.String)
142
	 */	
143
	public OGCClientOperation createOperation(String name, String onlineResource) {
144
		return new WMSOperation(name, onlineResource);
145
	}	
146

  
147
 }
148

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.148/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/wms/WMSEventListener.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
25
package org.gvsig.remoteclient.wms;
26
/**
27
 * Interface for monitoring events from the WMSClient.
28
 * @author jaume dominguez faus - jaume.dominguez@iver.es
29
 *
30
 */
31
public interface WMSEventListener {
32
	public static final int CAPABILITIES = 1;
33
	public static final int MAP = 2;
34
	public static final int FEATURE_INFO = 2;
35
	public static final int FINISHED = -1;
36
	public static final int STARTED = -2;
37
	public static final int TRANSFERRING = -3;
38
	public static final int FAILED = -4;
39
	public static final int CANCELLED = -5;
40
	
41
	public abstract void newEvent(int idRequest, int eventType);
42
}
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.148/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/wms/WMSExtent.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.wms;
25

  
26
import java.io.IOException;
27

  
28
import org.kxml2.io.KXmlParser;
29
import org.xmlpull.v1.XmlPullParserException;
30

  
31
import org.gvsig.remoteclient.utils.CapabilitiesTags;
32

  
33
public class WMSExtent {
34
	    
35
    private String name; 
36
    /**
37
     * Indicates that the server will round off inexact dimension values
38
     * to the nearest valid value, or (if it is null or zero) it will not.
39
     */
40
    private String nearestValue; 
41
    /**
42
     * Indicates that temporal data are normally kept current and that the
43
     * request parameter TIME <b>may</b> include the keyword 'current' 
44
     * instead of an ending value. 
45
     */
46
    private String current;
47
    
48
    /**
49
     * cotains the expression for this dimension's extent.
50
     */
51
    private String extentExpression;
52
    private String extDefaultValue;
53

  
54
    public String getName() {        
55
        return name;
56
    } 
57
    
58
    /**
59
     * Tells that the temporal data are normally kept current and that
60
     * the request parameter TIME may include the keyword 'current'
61
     * instead of an ending value.
62
     *
63
     * @return <b>true</b> if the server does keep the data, <b>false</b> else.
64
     */
65
    public boolean allowsCurrentTime() {
66
        return (current!=null && !current.equals("0"));
67
    }
68
    
69
    /**
70
     * Gets the value that would be used along this dimension if a Web
71
     * request omits a value for the dimension.
72
     * 
73
     * @return Returns the defaultValue.
74
     */
75
    public String getDefaultValue() {
76
        return extDefaultValue;
77
    }
78
    
79
    /**
80
     * Returns the extent expression as it was written in the Capabilities 
81
     * document.
82
     * @return String
83
     */
84
    public String getExtentExpression() {
85
        return extentExpression;
86
    }
87
       
88

  
89
    /**
90
     * @return Returns the nearestValues.
91
     */
92
    public boolean allowsNearestValue() {
93
        return (nearestValue!=null && !nearestValue.equals("0"));
94
    }	 
95

  
96
	   /**
97
	 * Parses the EXTENT tag in the WMS capabilities, filling the Extend fills of the
98
	 * WMSDimension object and loading the data into memory to be easily accesed.
99
	 */
100
	public void parse(KXmlParser parser) throws IOException, XmlPullParserException{
101
	    parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.EXTENT);
102
	    name			 = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_NAME);
103
	    extDefaultValue  = parser.getAttributeValue("", CapabilitiesTags.DEFAULT);
104
	    nearestValue    = parser.getAttributeValue("", CapabilitiesTags.EXTENT_NEAREST_VALUE);
105
	    current          = parser.getAttributeValue("", CapabilitiesTags.EXTENT_CURRENT);
106
	    extentExpression = parser.nextText();
107
	}	
108
}
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.148/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/wms/WMSProtocolHandlerFactory.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
25
package org.gvsig.remoteclient.wms;
26

  
27
import java.io.File;
28
import java.io.IOException;
29
import java.io.StringReader;
30
import java.net.ConnectException;
31
import java.net.URL;
32
import java.util.ArrayList;
33
import java.util.Iterator;
34
import org.apache.commons.io.FileUtils;
35

  
36
import org.gvsig.remoteclient.utils.CapabilitiesTags;
37
import org.gvsig.remoteclient.utils.Utilities;
38
import org.kxml2.io.KXmlParser;
39
import org.slf4j.Logger;
40
import org.slf4j.LoggerFactory;
41
import org.xmlpull.v1.XmlPullParserException;
42

  
43
public class WMSProtocolHandlerFactory {
44
    
45
    private static final Logger logger = LoggerFactory.getLogger(WMSProtocolHandlerFactory.class);
46
    public org.gvsig.remoteclient.wms.WMSProtocolHandler wMSProtocolHandler;
47

  
48
    private static ArrayList supportedVersions = new ArrayList();
49

  
50
    static {
51
        /*
52
         * Se meten en el array versions las distintas versiones
53
         * del protocolo en orden descendente
54
         */
55
    	//versions.add(WMSProtocolHandler1_3_0.class);
56
        //versions.add(WMSProtocolHandler1_1_1.class);
57
    	supportedVersions.add("1.3.0");
58
    	supportedVersions.add("1.1.1");
59
    	supportedVersions.add("1.1.0");
60
     }
61

  
62
    /**
63
     * M?todo que dada una respuesta de getCapabilities y un iterador sobre una
64
     * coleccion de WMSClient's ordenada descendentemente devuelve el cliente
65
     * cuya version es igual o inmediatamente inferior
66
     *
67
     * @param caps Capabilities con la respuesta del servidor
68
     * @param clients Iterador de conjunto ordenado descendientemente
69
     *
70
     * @return cliente cuya version es igual o inmediatamente inferior
71
     * @throws IllegalAccessException
72
     * @throws InstantiationException
73
     *
74
     */
75
    private static String getDriverVersion(String version, Iterator clients) throws InstantiationException, IllegalAccessException {
76
        while (clients.hasNext()) {
77
            String clientVersion = (String)clients.next();
78
            int ret = version.compareTo(clientVersion);
79

  
80
            if (ret >= 0) {
81
                return clientVersion;
82
            }
83
        }
84
        return null;
85
    }
86

  
87
    /**
88
     * Establece la versi?n con la que se comunicar? con el servidor y devuelve
89
     * el objeto Capabilities obtenido con dicha versi?n
90
     *
91
     * @param host maquina con la que se negocia
92
     *
93
     * @return instancia de un cliente capaz de negociar con el host que se
94
     *         pasa como par?metro
95
     */
96
     public static WMSProtocolHandler negotiate(String host) throws ConnectException, IOException {
97

  
98
        if (supportedVersions.size() == 0)
99
        {
100
        	return null;
101
        }
102

  
103
        try
104
        {
105
        	String highestVersionSupportedByServer  = getSuitableWMSVersion(host,"");
106
        	if (supportedVersions.contains(highestVersionSupportedByServer))
107
        	{
108
        		//we support the highest version supported by the server
109
        		// this is the best case
110
        		return createVersionDriver(highestVersionSupportedByServer);
111
        	}
112

  
113

  
114
        else
115
        	{
116
        		// in case we dont support the highest version from the server
117
        		// we start the negotiation process in which we have to get the higest version
118
        		// the WMS supports and we are able to read.
119
        		Iterator iVersion = supportedVersions.iterator();
120
        		String wmsVersion;
121
        		String gvSIGVersion;
122

  
123
        		while (iVersion.hasNext()) {
124
		                gvSIGVersion = (String)iVersion.next();
125
		                wmsVersion = getSuitableWMSVersion(host,gvSIGVersion);
126
		                //TODO:
127
		                //compare with the version returned by the WMS!!!!!
128
		                // send GetCapabilities and read the version to compare.
129
		                int res = wmsVersion.compareTo(gvSIGVersion);
130

  
131
		                if (res == 0) { //Si es la misma que nuestra version
132
		                    return createVersionDriver(gvSIGVersion);
133
		                } else if (res > 0) { //Si es mayor que nuestra version
134
		                    throw new Exception("Server Version too high: " + wmsVersion);
135
		                } else { //Si es menor que nuestra version
136
		                         //Obtenemos la primera version menor o igual que tengamos
137
		                    String lowerVersion = WMSProtocolHandlerFactory.getDriverVersion(wmsVersion, iVersion);
138

  
139
		                    if (lowerVersion == null) { //Si no hay ninguna
140
		                        throw new Exception("Lowest server version is " + wmsVersion);
141
		                    } else {
142
		                        if (lowerVersion.equals(wmsVersion)) {
143
		                            return createVersionDriver(lowerVersion);
144
		                        } else { //Si hay una version menor que la que retorno el servidor
145
		                            //iV = lower;
146
		                        }
147
		                    }
148
		                }
149
        		}
150
        	}//case we had to start the negotiation process.
151
	        return null; // if it did not find any suitable version.
152
        }
153
        catch(ConnectException conEx)
154
        {
155
        	throw conEx;
156
        }
157
        catch(IOException ioEx)
158
        {
159
        	throw ioEx;
160
        }
161
        catch(Exception e)
162
        {
163
                logger.warn("Can't determine server version",e);
164
          	return null;
165
        }
166
    }
167

  
168
     /**
169
      * Sends a GetCapabilities to the WMS server to get the version
170
      * if the version parameter is null, the WMS will return the highest version supported
171
      * if not it will return the lower highest version than the one requested.
172
      * @param host
173
      * @param version
174
      * @return suitable version supported by the server
175
      */
176
     private static String getSuitableWMSVersion(String host, String _version) throws ConnectException, IOException
177
     {
178
         int sizes[] = new int[] { 1024, 1024*10, 1024*50, 1024*100 };
179
         XmlPullParserException  xmlEx = null;
180
         for( int i=0; i<sizes.length; i++ ) {
181
             String version;
182
             try {
183
                 version = getSuitableWMSVersion(host, _version, sizes[i]);
184
                 return version;
185
             } catch (XmlPullParserException ex) {
186
                 xmlEx = ex;
187
                 // Try with other size
188
             }
189
         }
190
         logger.warn("Can't determine server version",xmlEx);
191
         return "";
192
     }
193
     
194
    private static String readFromUrl(String url_s, int size) throws IOException {
195
            URL url = new URL(url_s);
196
            Utilities.removeURL(url);
197
            File f = Utilities.downloadFile(url, "wms_capabilities.xml", null);
198
            return FileUtils.readFileToString(f);
199
    }
200
    
201
    private static String getSuitableWMSVersion(String host, String _version, int size) throws ConnectException, IOException, XmlPullParserException {
202
        String request = WMSProtocolHandler.buildCapabilitiesSuitableVersionRequest(host, _version);
203
        String version = new String();
204
        StringReader reader = null;
205
        try {
206
            String string = readFromUrl(request, size);
207
            
208
            // patch for ArcIMS + WMS connector > 9.0 bug
209
            int a = string.toLowerCase().indexOf("<?xml");
210
            if ( a != -1 ) {
211
                string = string.substring(a, string.length());
212
            }
213
            // end patch
214

  
215
            reader = new StringReader(string);
216
            KXmlParser kxmlParser = null;
217
            kxmlParser = new KXmlParser();
218
            kxmlParser.setInput(reader);
219
            kxmlParser.nextTag();
220
            if ( kxmlParser.getEventType() != KXmlParser.END_DOCUMENT ) {
221
                if ( (kxmlParser.getName().compareTo(CapabilitiesTags.CAPABILITIES_ROOT1_1_0) == 0)
222
                        || (kxmlParser.getName().compareTo(CapabilitiesTags.CAPABILITIES_ROOT1_1_1) == 0)
223
                        || (kxmlParser.getName().compareTo(CapabilitiesTags.CAPABILITIES_ROOT1_3_0) == 0) ) {
224
                    version = kxmlParser.getAttributeValue("", CapabilitiesTags.VERSION);
225
                }
226
            }
227
            // do not forget to close the Stream.
228
            reader.close();
229
            reader = null;
230
            return version;
231
        } catch (ConnectException conEx) {
232
            throw new ConnectException(conEx.getMessage());
233
        } catch (IOException ioEx) {
234
            throw new IOException(ioEx.getMessage());
235
        } catch (XmlPullParserException xmlEx) {
236
            throw xmlEx;
237
//                    logger.warn("Can't determine server version",xmlEx);
238
//                    return "";
239
        } finally {
240
            if ( reader != null ) {
241
                try {
242
                    reader.close();
243
                } catch (Exception ex) {
244
                    logger.warn("Can't close reader", ex);
245
                }
246
            }
247
        }
248
    }
249

  
250
     /**
251
      * It creates an instance of a WMSDriver class.
252
      *
253
      * @param String, with the version of the driver to be created
254
      * @return WMSDriver.
255
      */
256
       private static WMSProtocolHandler createVersionDriver(String version)
257
       {
258
         try
259
         {
260
           Class driver;
261
           version = version.replace('.', '_');
262
           driver = Class.forName("org.gvsig.remoteclient.wms.wms_"+version+".WMSProtocolHandler" + version);
263
           return (WMSProtocolHandler)driver.newInstance();
264
         }
265
         catch (Exception e)
266
         {
267
                logger.warn("Can't create WMS protocol handler for version '"+version+"'.",e);
268
           //throw new Exception("WMSDriverFactory. Unknown driver version " + e);
269
        	 return null;
270
         }
271
       }
272

  
273
 }
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.148/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/wms/WMSLayer.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.wms;
25

  
26
import java.io.IOException;
27
import java.util.ArrayList;
28
import java.util.Hashtable;
29
import java.util.TreeMap;
30
import java.util.Vector;
31

  
32
import org.kxml2.io.KXmlParser;
33
import org.xmlpull.v1.XmlPullParserException;
34

  
35
import org.gvsig.remoteclient.utils.BoundaryBox;
36
import org.gvsig.remoteclient.utils.CapabilitiesTags;
37

  
38
/**
39
 * <p>Abstract class that defines an WMSLayer.</p>
40
 *
41
 */
42
public abstract class WMSLayer implements org.gvsig.remoteclient.ILayer {
43

  
44
    protected ArrayList children;
45
    protected WMSLayer parent;
46

  
47
    /**
48
     * <p>Layer Abstract field in the capabilities document </p>
49
     */
50
    private String layerAbstract;
51

  
52
    /**
53
     * <p>Themes provided by the WMS for the layer</p>
54
     */
55
    public ArrayList styles = new ArrayList();
56

  
57
    /**
58
     * <p>Layer name</p>
59
     */
60
    private String name;
61

  
62
    /**
63
     * <p>Layer title</p>
64
     */
65
    private String title;
66

  
67
    private ArrayList keywordList = new ArrayList();
68
    /**
69
     * <p>CRS list of this layer (Tag CRS)</p>
70
     */
71
    protected Vector srs = new Vector();
72

  
73
    /**
74
     * <p>Bounding box por CRS (Tag BoundingBox)</p>
75
     */
76
    private Hashtable bBoxes  = new Hashtable();
77

  
78
    /**
79
     * <p>extents that defines the bbox for the LatLon projection
80
     * It can be included in the bBoxes vector as well, because it is the most used, we keep it separeted too, according
81
     *  with the OGC WMSCapabilities specifications...
82
     */
83
    private org.gvsig.remoteclient.utils.BoundaryBox latLonBbox;
84

  
85
    /**
86
     * <p>min scale for the layer to be visible</p>
87
     */
88
    private double scaleMin;
89

  
90
    /**
91
     * <p>max scale for the layer to be visible</p>
92
     */
93
    private double scaleMax;
94

  
95
    /**
96
     * <p>Dimensions defined for the layer in the capabilities doc</p>
97
     */
98
    protected java.util.ArrayList dimensions = new ArrayList();
99

  
100
    /**
101
     * Tells if this layer accepts getFeatureInfo requests.
102
     */
103
    private boolean queryable = false;
104

  
105
    /**
106
     * Tells if this layer is opaque.
107
     */
108
    private boolean opaque = false;
109
    /**
110
     * when set to true, noSubsets indicates that the server is not able to make a map
111
     * of a geographic area other than the layer's bounding box.
112
     */
113
    private boolean m_noSubSets = false;
114

  
115
    /**
116
     * when present and non-zero fixedWidth and fixedHeight indicate that the server is not
117
     * able to produce a map of the layer at a width and height different from the fixed sizes indicated.
118
     */
119
    private int fixedWidth = 0;
120
    private int fixedHeight = 0;
121

  
122
    /**
123
     * Tells if this layer can be served with transparency.
124
     */
125
    private boolean transparency;
126

  
127
    /**
128
     * <p>Parses the LAYER tag in the WMS capabilities, filling the WMSLayer object
129
     * loading the data in memory to be easily accesed</p>
130
     *
131
     */
132
    public abstract void parse(KXmlParser parser, TreeMap layerTreeMap)
133
    throws IOException, XmlPullParserException;
134

  
135
    //public abstract ArrayList getAllDimensions();
136

  
137
    /**
138
     * add a new keyword to the keywordList.
139
     * @param key
140
     */
141
    protected void addkeyword(String key) {
142
    	keywordList.add(key);
143
    }
144
    
145
    public ArrayList getKeywords() {
146
    	return keywordList;
147
    }
148
    
149
    /**
150
     * <p>Adds a style to the styles vector</p>
151
     * @param _style
152
     */
153
    public void addStyle(org.gvsig.remoteclient.wms.WMSStyle _style) {
154
        styles.add( _style );    
155
    }
156

  
157
    /**
158
     * <p>Gets the style vector</p>
159
     * @return
160
     */
161
    public ArrayList getStyles() {
162
    	ArrayList list = new ArrayList();
163
    	if (styles != null)
164
    		list.addAll(styles);
165
    	if (this.getParent()!= null) {
166
    		//return getAllStyles(this);
167
    		if(this.getParent().getStyles() != null)
168
    			list.addAll(this.getParent().getStyles());
169
    	}
170
        return list;
171
    }
172

  
173
    public ArrayList getAllStyles(WMSLayer layer) {
174
    	if (layer.getParent()!= null) {
175
    		ArrayList list = getAllStyles(layer.getParent());
176
    		for(int i = 0; i < this.styles.size(); i++) {
177
    			list.add(styles.get(i));
178
    		}
179
    		return list;
180
    	} else {
181
    		return styles;
182
    	}
183
    }
184
    
185
    /**
186
     * <p>Adds a bbox to the Bboxes vector</p>
187
     * @param bbox
188
     */
189
    public void addBBox(BoundaryBox bbox) {
190
        bBoxes.put(bbox.getSrs(), bbox);
191
    }
192

  
193
    /**
194
     * <p>returns the bbox with that id in the Bboxes vector</p>
195
     * @param id
196
     */
197
    public BoundaryBox getBbox(String id) {
198
    	//Si hay una bounding box definida para esa capa y ese crs, se usa esa
199
    	BoundaryBox b = (BoundaryBox) bBoxes.get(id);
200
    	if(b != null)
201
    		return b;
202
    	
203
    	if ((id.compareToIgnoreCase( CapabilitiesTags.EPSG_4326 )==0)
204
    		||(id.compareToIgnoreCase( CapabilitiesTags.CRS_84)==0)) {
205
    		if (latLonBbox != null)
206
    		return (BoundaryBox)latLonBbox;
207
    	}
208
        
209
        if (parent!=null)
210
            return parent.getBbox(id);
211
        return null;
212
    }
213

  
214
    /**
215
     * <p>Gets the bBoxes vector</p>
216
     * @return
217
     */
218
    public Hashtable getBboxes() {
219
        return bBoxes;
220
    }
221

  
222

  
223
    //Methods to manipulate the box that defines the layer extent in LatLon SRS.
224
    public BoundaryBox getLatLonBox() {
225
        return latLonBbox;
226
    }
227
    
228
    public void setLatLonBox(BoundaryBox box) {
229
        latLonBbox = box;
230
    }
231
    
232
    /**
233
     * <p>adds a new srs to the srs vector</p>
234
     */
235
    public void addSrs(String srs) {
236
    	if (!this.srs.contains(srs))
237
    		this.srs.add(srs);
238
    }
239
    
240
    public void removeSrs(String srs) {
241
   		this.srs.remove(srs);
242
    }
243

  
244
    public Vector getAllSrs() {
245
        Vector mySRSs = (Vector) this.srs.clone();
246
        if (parent!=null)
247
            mySRSs.addAll(parent.getAllSrs());
248
        return mySRSs;
249
    }
250

  
251
    /**
252
     * <p>gets the maximum scale for this layer</p>
253
     * @return
254
     */
255
    public double getScaleMax() {
256
        return scaleMax;
257
    }
258

  
259
    /**
260
     * <p>gets the minimum scale for this layer</p>
261
     * @return
262
     */
263
    public double getScaleMin() {
264
        return scaleMin;
265
    }
266

  
267
    /**
268
     * <p>sets the minimum scale for this layer to be visible.</p>
269
     *
270
     * @param scale
271
     */
272
    public void setScaleMin(double scale) {
273
        scaleMin = scale;
274
    }
275

  
276
    /**
277
     * <p>sets the maximum scale for this layer to be visible</p>
278
     * @param scale
279
     */
280
    public void setScaleMax(double scale) {
281
        scaleMax = scale;
282
    }
283

  
284
    /**
285
     * <p> gets the dimension vector defined in this layer</p>
286
     * @return
287
     */
288
    public abstract ArrayList getDimensions();
289

  
290
    public WMSDimension getDimension(String name) {
291
    	for(int i = 0; i < dimensions.size(); i++ ) {
292
    		if(((WMSDimension)dimensions.get(i)).getName().compareTo(name) == 0) {
293
    			return (WMSDimension)dimensions.get(i);
294
    		}
295
    	}
296
    	return null;
297
    }
298

  
299
    /**
300
     * <p>Adds a dimension to the dimension vector </p>
301
     * @param dimension
302
     */
303
    public void addDimension(org.gvsig.remoteclient.wms.WMSDimension dimension) {
304
        dimensions.add(dimension);
305
    }
306

  
307
    /**
308
     * <p>Gets layer name</p>
309
     * @return
310
     */
311
    public String getName() {
312
        return this.name;
313
    }
314

  
315
    /**
316
     * <p>Sets layer name</p>
317
     * @param _name
318
     */
319
    public void setName(String name) {
320
        this.name = name;
321
    }
322

  
323
    /**
324
     * <p>Gets layer title</p>
325
     * @return
326
     */
327
    public String getTitle() {
328
        return title;
329
    }
330

  
331
    /**
332
     * <p>Sets the layer title</p>
333
     * @param _title
334
     */
335
    public void setTitle(String title) {
336
        this.title = title;
337
    }
338

  
339
    /**
340
     * <p>Gets the layer abstract</p>
341
     * @return
342
     */
343
    public String getAbstract() {
344
        return layerAbstract;
345
    }
346

  
347
    /**
348
     * <p>Sets the layer abstract</p>
349
     * @param m_abstract
350
     */
351
    public void setAbstract(String _abstract) {
352
        layerAbstract = _abstract;
353
    }
354

  
355

  
356
    public ArrayList getChildren() {
357
        return children;
358
    }
359

  
360

  
361
    public void setChildren(ArrayList children) {
362
        this.children = children;
363
    }
364

  
365

  
366
    public WMSLayer getParent() {
367
        return parent;
368
    }
369

  
370

  
371
    public void setParent(WMSLayer parent) {
372
        this.parent = parent;
373
    }
374

  
375
    public String toString(){
376
        return this.getTitle();
377
    }
378

  
379

  
380
    /**
381
     * Tells if this layer accepts getFeatureInfo requests.
382
     */
383
    public boolean isQueryable() {
384
        return queryable;
385
    }
386

  
387

  
388
    /**
389
     * @param queryable The queryable to set.
390
     */
391
    public void setQueryable(boolean queryable) {
392
        this.queryable = queryable;
393
    }
394

  
395
    /**
396
     * Tells if this layer is opaque.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff