Statistics
| Revision:

gvsig-raster / org.gvsig.raster.wms / trunk / org.gvsig.raster.wms / org.gvsig.raster.wms.remoteclient / src / main / java / org / gvsig / remoteclient / exceptions / WMSWrongSizeException.java @ 3083

History | View | Annotate | Download (4.23 KB)

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
}