Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / RasterAdapter.java @ 1100

History | View | Annotate | Download (2.93 KB)

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

    
46
import java.awt.Dimension;
47
import java.awt.Graphics2D;
48
import java.awt.Image;
49
import java.awt.geom.Rectangle2D;
50
import java.awt.image.BufferedImage;
51

    
52
import org.cresques.cts.ICoordTrans;
53

    
54
import com.hardcode.driverManager.Driver;
55
import com.iver.cit.gvsig.fmap.ViewPort;
56
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
57
import com.iver.cit.gvsig.fmap.drivers.RasterDriver;
58
import com.iver.cit.gvsig.fmap.operations.Cancellable;
59

    
60
/**
61
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
62
 */
63
public class RasterAdapter {
64
        private RasterDriver driver;
65
        
66
    /**
67
     * Establece el driver sobre el que act?a el adaptador 
68
     */
69
    public void setDriver(Driver driver) {
70
            this.driver = (RasterDriver) driver;
71
    }
72

    
73
        /**
74
     * Obtiene una referencia al objeto que implementa la interfaz vectorial con
75
     *  el fin de que las Strategy puedan optimizar en funci?n del driver.
76
     */
77
    public Driver getDriver(){
78
            return driver;
79
    }
80
    
81
        /**
82
         * Obtiene una imagen de tama?o especificado, de la zona (en
83
         * coordenadas de usuario) que se le pide.
84
         * @param size        Tama?o (en p?xeles de im?gen).
85
         * @param userSize Zona especificada (en coordenadas de usuario).
86
         * @param rp Reproyecci?n.
87
         * @return La imagen.
88
         */
89
        public Image getImage(Dimension size, Rectangle2D userSize, ICoordTrans rp) {
90
                return ((RasterDriver) driver).getImage(size, userSize, rp);
91
        }
92

    
93
        /**
94
         * @see com.iver.cit.gvsig.fmap.layers.LayerOperations#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort)
95
         */
96
        public void draw(BufferedImage image, Graphics2D g, ViewPort vp, Cancellable cancel) throws DriverIOException {
97
                ((RasterDriver) driver).draw(image,g, vp);
98
        }
99

    
100

    
101
}