Revision 21577

View differences:

trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/imagenavigator/ImageUnavailable.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 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
package org.gvsig.gui.beans.imagenavigator;
20
/**
21
 * Excepcion para cuando no se puede visualizar una imagen en ImageNavigator
22
 * 
23
 * @version 12/06/2008
24
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
25
 */
26
public class ImageUnavailable extends Exception {
27
	private static final long serialVersionUID = -4801264886991752651L;
28
	
29
	/**
30
	 * Constructs a new exception with the specified detail message.  The
31
	 * cause is not initialized, and may subsequently be initialized by
32
	 * a call to {@link #initCause}.
33
	 *
34
	 * @param   message   the detail message. The detail message is saved for 
35
	 *          later retrieval by the {@link #getMessage()} method.
36
	 */
37
	public ImageUnavailable(String message) {
38
		super(message);
39
	}
40
}
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/imagenavigator/ImageNavigator.java
426 426
			try {
427 427
				errorDrawing = false;
428 428
				iClient.drawImage(getCacheGraphics(), newX1, newY1, newX2, newY2, zoom, this.getWidth(), this.getHeight());
429
			} catch (ImageUnavailable e) {
429
			} catch (ImageUnavailableException e) {
430 430
				getCacheGraphics().setColor(new Color(224, 224, 224));
431 431
				getCacheGraphics().fillRect(0, 0, width, height);
432 432
				errorDrawing = true;
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/imagenavigator/IClientImageNavigator.java
21 21
	 * @param zoom
22 22
	 * @param width
23 23
	 * @param height
24
	 * @throws ImageUnavailable
24
	 * @throws ImageUnavailableException
25 25
	 */
26
	public void drawImage(Graphics2D g, double x1, double y1, double x2, double y2, double zoom, int width, int height) throws ImageUnavailable;
26
	public void drawImage(Graphics2D g, double x1, double y1, double x2, double y2, double zoom, int width, int height) throws ImageUnavailableException;
27 27
}
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/imagenavigator/ImageUnavailableException.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 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
package org.gvsig.gui.beans.imagenavigator;
20
/**
21
 * Excepcion para cuando no se puede visualizar una imagen en ImageNavigator
22
 * 
23
 * @version 12/06/2008
24
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
25
 */
26
public class ImageUnavailableException extends Exception {
27
	private static final long serialVersionUID = -4801264886991752651L;
28
	
29
	/**
30
	 * Constructs a new exception with the specified detail message.  The
31
	 * cause is not initialized, and may subsequently be initialized by
32
	 * a call to {@link #initCause}.
33
	 *
34
	 * @param   message   the detail message. The detail message is saved for 
35
	 *          later retrieval by the {@link #getMessage()} method.
36
	 */
37
	public ImageUnavailableException(String message) {
38
		super(message);
39
	}
40
}
trunk/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/imagenavigator/TestImageNavigator.java
65 65
	 * (non-Javadoc)
66 66
	 * @see org.gvsig.gui.beans.imagenavigator.IClientImageNavigator#drawImage(java.awt.Graphics2D, double, double, double, double, double, int, int)
67 67
	 */
68
	public void drawImage(Graphics2D g, double x1, double y1, double x2, double y2, double zoom, int width, int height) throws ImageUnavailable {
68
	public void drawImage(Graphics2D g, double x1, double y1, double x2, double y2, double zoom, int width, int height) throws ImageUnavailableException {
69 69
		if (true) {
70
			throw new ImageUnavailable("No es posible la visualizaci?n de la capa.");
70
			throw new ImageUnavailableException("No es posible la visualizaci?n de la capa.");
71 71
		}
72 72
		double usex1 = (((0 - x1) * width) / (width/zoom));
73 73
		double usey1 = (((0 - y1) * height) / (height/zoom));

Also available in: Unified diff