Statistics
| Revision:

svn-gvsig-desktop / tags / Root_v06 / libraries / libRemoteServices / src / org / gvsig / remoteClient / exceptions / WMSWrongSizeException.java @ 4811

History | View | Annotate | Download (4.48 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.remoteClient.exceptions;
42

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

77
Par?metros erroneos:
78
prefijo = 
79
mapa =  0
80
formato = IMAGE/JPEG
81
XMin =  1.1578804698593
82
YMin =  53.5852110737936
83
XMax =  10.3
84
YMax =  53.8000038968219
85
AnchoPixels =  64
86
AltoPixels =  5023
87
Transparente = TRUE
88
Descripci?n error:
89
AltoPixels > 2000
90
</ServiceException>
91
</ServiceExceptionReport>
92
 * </pre>
93
 * 
94
 * <pre>
95
         <?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
96
<!DOCTYPE ServiceExceptionReport SYSTEM "http://schemas.opengeospatial.net/wms/1.1.1/exception_1_1_1.dtd">
97
<ServiceExceptionReport version="1.1.1">
98
<ServiceException>
99
msWMSLoadGetMapParams(): WMS server error. Image size out of range, WIDTH and HEIGHT must be between 1 and 2048 pixels.
100
</ServiceException>
101
</ServiceExceptionReport>
102

103
 * </pre>
104
 */
105
public class WMSWrongSizeException extends WMSException 
106
{        
107
        private int height = -1;
108
        private int width = -1;
109
        
110
        /**
111
         *
112
         */
113
        public WMSWrongSizeException() {
114
                super();
115
        }
116

    
117
        /**
118
         * Crea WMSException.
119
         *
120
         * @param message
121
         */
122
        public WMSWrongSizeException(String message) {
123
                super(message);
124
        }
125

    
126
        /**
127
         * Crea WMSException.
128
         *
129
         * @param message
130
         * @param cause
131
         */
132
        public WMSWrongSizeException(String message, Throwable cause) {
133
                super(message, cause);
134
        }
135

    
136
        /**
137
          * Crea WMSException.
138
         *
139
         * @param cause
140
         */
141
        public WMSWrongSizeException(Throwable cause) {
142
                super(cause);
143
        }
144
        
145
        public int getWidth()
146
        {
147
                return width; 
148
        }
149
        public int getHeight()
150
        {
151
                return height;
152
        }
153
        public void setWidth(int w)
154
        {
155
                width =w;
156
        }
157
        public void setHeight(int h)
158
        {
159
                height =h;
160
        }
161
        
162
        /**
163
         * Checks if the argument is a WrongSizeError message, in this
164
         * case throws a WMSWrongSizeException
165
         * @param errorMsg El mensaje de error que pasa el server.
166
         * @throws WMSException
167
         */
168
        public static void check(String errorMsg) throws WMSException 
169
        {
170
                //TODO:
171
                //check the errorMsg to see if it matches with one of the 
172
                // well known string error messages.
173
        }
174
}