Statistics
| Revision:

gvsig-raster / org.gvsig.raster.georeferencing / trunk / org.gvsig.raster.georeferencing / org.gvsig.raster.georeferencing.swing / org.gvsig.raster.georeferencing.swing.impl / src / main / java / org / gvsig / raster / georeferencing / swing / impl / view / CanvasZone.java @ 1726

History | View | Annotate | Download (19.5 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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
 */
22
package org.gvsig.raster.georeferencing.swing.impl.view;
23

    
24
import java.awt.AlphaComposite;
25
import java.awt.Color;
26
import java.awt.Graphics;
27
import java.awt.Graphics2D;
28
import java.awt.event.MouseEvent;
29
import java.awt.event.MouseListener;
30
import java.awt.event.MouseMotionListener;
31
import java.awt.geom.AffineTransform;
32
import java.awt.geom.Point2D;
33
import java.awt.geom.Rectangle2D;
34
import java.awt.image.BufferedImage;
35
import java.util.ArrayList;
36
import java.util.List;
37

    
38
import javax.swing.JPanel;
39

    
40
import org.gvsig.raster.georeferencing.swing.impl.tool.BaseViewTool;
41
import org.gvsig.raster.georeferencing.swing.view.GeorefCanvas;
42
import org.gvsig.raster.georeferencing.swing.view.IGraphicLayer;
43
import org.gvsig.raster.georeferencing.swing.view.ViewEvent;
44
import org.gvsig.raster.georeferencing.swing.view.ViewListener;
45

    
46
/**
47
 * Zona de dibujado del raster
48
 * 21/12/2007
49
 * @author Nacho Brodin nachobrodin@gmail.com
50
 */
51
public class CanvasZone extends JPanel implements GeorefCanvas, MouseListener, MouseMotionListener {
52
        private static final long      serialVersionUID     = 1308683333757367640L;
53
        
54
        private BufferedImage          image                = null;
55
        private double                 scale                = 1;
56
        private Rectangle2D            extent               = null;
57
        private double                 pixelSize            = 1;
58
        private Point2D                center               = null;
59
        private List<IGraphicLayer>    graphicLayers        = new ArrayList<IGraphicLayer>();
60
        /**
61
         * ?ltimo extent aplicado. Si no ha variado el siguiente a aplicar no hace falta que releamos de nuevo
62
         */
63
        private Rectangle2D            lastExtent           = null;
64
        //Ultimo Image con la capa dibujada y con la transformaci?n que tiene en cuenta los desplazamientos dentro de un pixel
65
        //Este buffer no varia hasta que se hace la siguiente petici?n de setDrawParams
66
        private BufferedImage          lastImage            = null;
67
        //lastImage sobre el que se pintan las capas gr?ficas. Este buffer varia en cada repaint. El orden en el que se carga
68
        //es: se vuelva el lastImage, se pintan las capas gr?ficas, se pintan las tools.
69
        private BufferedImage          lastImageWithLayers  = null;
70
    
71
    private boolean                clear                = false;
72
    private BaseViewTool           selectedTool         = null;
73
    
74
    private Point2D                realCoord            = new Point2D.Double(0, 0);
75
    //private Point2D                viewCoord = new Point2D.Double(0, 0);
76
    private boolean                showInfo             = false;
77
    /**
78
     * Informa de que la esquina superior izquierda corresponde con el valor de m?nimo X y
79
     * m?ximo Y. En caso de ser false esta esquina ser?a de m?nimo X y m?nimo Y.
80
     */
81
    private boolean                minxMaxyUL           = true;
82
                    
83
    private Color                  backgroundColor      = Color.BLACK;
84
    private Color                  textColor            = Color.RED;
85
    
86
    /**
87
     * Normalmente no se hace una petici?n al dibujado del raster si el extent no ha variado. Si esta variable
88
     * est? a true fuerza que haya una petici?n de redibujado aunque el extent del raster no haya cambiado.
89
     * Esto solo se hace para una petici?n. La siguiente vuelve a estar a false.
90
     */
91
    private boolean                forceRequest         = false;
92
    
93
    private ViewListener           viewListener         = null;
94
    /**
95
     * Creamos una sola instancia de Event para no tener que malgastar recursos
96
     * creando una en cada dibujado
97
     */
98
    private ViewEvent              viewEvent            = null;
99
    
100
    private AffineTransform        panAT                = new AffineTransform();
101
    //private BufferedImage          draggedImage         = null;
102
    
103
    /**
104
         * Asigna los par?metros de dibujado
105
         * @param img Buffer con un ?rea de datos
106
         * @param ext Rectangle2D del ?rea de datos dada 
107
         * @param pixelSize Tama?o de pixel
108
         * @param center Punto del ?rea de datos donde se quiere centrar el dibujado del buffer
109
         */
110
        public void setDrawParams(BufferedImage img, Rectangle2D ext, double pixelSize, Point2D center) {
111
                this.image = img;
112
                this.extent = ext;
113
                this.pixelSize = pixelSize;
114
                this.center = center;
115
                this.addMouseListener(this);
116
                this.addMouseMotionListener(this);
117
                repaint();
118
        }
119
        
120
        /**
121
         * Asigna el listener de eventos de la vista
122
         * @param listener
123
         */
124
        public void setViewListener(ViewListener listener) {
125
                this.viewListener = listener;
126
                viewEvent = new ViewEvent(this);
127
        }
128
        
129
        /**
130
         * Asigna un nuevo centro de visualizaci?n
131
         * @param center
132
         */
133
        public void setCenter(Point2D center) {
134
                this.center = center;
135
                repaint();
136
        }
137
        
138
        /**
139
         * Conversi?n de un punto en coordenadas del canvas a reales
140
         * @param p
141
         * @return
142
         */
143
        public Point2D viewCoordsToWorld(Point2D p) {
144
                int w = getVisibleRect().width;
145
                int h = getVisibleRect().height;
146
                double cx = extent.getMinX() + ((p.getX() * extent.getWidth()) / w);
147
                double cy = 0;
148
                if(minxMaxyUL) //Cuando las Y decrecen de arriba a abajo
149
                        cy = extent.getMaxY() - (p.getY() * extent.getHeight()) / h;
150
                else //Cuando las Y crecen de arriba a abajo
151
                        cy = extent.getMinY() + (p.getY() * extent.getHeight()) / h;
152
                return new Point2D.Double(cx, cy);
153
        }
154
        
155
        /**
156
         * Conversi?n de un punto en coordenadas del canvas a reales
157
         * @param p
158
         * @return
159
         */
160
        public Point2D viewCoordsFromWorld(Point2D p) {
161
                int w = getVisibleRect().width;
162
                int h = getVisibleRect().height;
163
                double cx = ((p.getX() - extent.getMinX()) * w) / extent.getWidth();
164
                double cy = 0;
165
                if(minxMaxyUL) //Cuando las Y decrecen de arriba a abajo
166
                        cy = ((extent.getMaxY() - p.getY()) * h) / extent.getHeight();
167
                else //Cuando las Y crecen de arriba a abajo
168
                        cy = ((p.getY() - extent.getMinY()) * h) / extent.getHeight();
169
                return new Point2D.Double(cx, cy);
170
        }
171
        
172
        /**
173
         * Obtiene el extent del canvas en coordenadas del mundo real
174
         * @return Rectangle2D
175
         */
176
        public Rectangle2D getExtent() {
177
                if(lastExtent == null)
178
                        return extent;
179
                return lastExtent;
180
        }
181
        
182
        /**
183
         * Asigna un nuevo centro de visualizaci?n en coordenadas del
184
         * componente.
185
         * @param center
186
         */
187
        public void setViewCenter(Point2D c) {
188
                int w = getVisibleRect().width;
189
                int h = getVisibleRect().height;
190
                
191
                double cx = (c.getX() * lastExtent.getWidth()) / w;
192
                double cy = (c.getY() * lastExtent.getHeight()) / h;
193
                setPixelCenter(new Point2D.Double(cx, cy));
194
        }
195
        
196
        /**
197
         * Asigna un nuevo centro de visualizaci?n en coordenadas pixel
198
         * del ?rea de dibujado (canvas). El nuevo centro ser? calculado en coordenadas
199
         * del mapa.
200
         * @param center
201
         */
202
        public void setPixelCenter(Point2D c) {
203
                int w = getVisibleRect().width;
204
                int h = getVisibleRect().height;
205
                
206
                //Calculamos el extent del canvas 
207
                Rectangle2D ext = getCanvasExtent(w, h, scale);
208
                
209
                //Calculamos el nuevo centro en coordenadas reales
210
                double wWC = (c.getX() / scale) * pixelSize;
211
                double hWC = (c.getY() / scale) * pixelSize;
212
                this.center = new Point2D.Double(ext.getMinX() + wWC,
213
                                                                                 ext.getMinY() - hWC);
214
                repaint();
215
        }
216
        
217
        /**
218
         * Asigna un nuevo centro de visualizaci?n en coordenadas pixel. Esta llamada tiene
219
         * en cuenta solo p?xeles completos. No centra sobre porciones de pixel cuando el zoom es
220
         * mayor de 1:1. El nuevo centro es en coordenadas del mapa pero siempre centrar?
221
         * en la esquina inferior izquierda del pixel.
222
         * @param center
223
         */
224
        public void setPixelCenter(int x, int y) {
225
                int w = getVisibleRect().width;
226
                int h = getVisibleRect().height;
227
                
228
                //Calculamos el extent del canvas 
229
                Rectangle2D ext = getCanvasExtent(w, h, scale);
230
                
231
                //Calculamos el nuevo centro en coordenadas reales
232
                double wWC = (x / scale) * pixelSize;
233
                double hWC = (y / scale) * pixelSize;
234
                Point2D center = new Point2D.Double(ext.getMinX() + wWC,
235
                                                                                          ext.getMinY() - hWC);
236
                
237
                //Calculamos la coordena pixel a la que pertenece esa coordenada real
238
                int pxX = (int)((center.getX() * (w / scale)) / ext.getWidth());
239
                int pxY = (int)((center.getY() * (h / scale)) / ext.getHeight());
240
                
241
                //Despu?s de haber convertido a pixel y redondeado la coordenada a entero volvemos a convertirla en real
242
                double wcX = (pxX * ext.getWidth()) / (w / scale);
243
                double wcY = (pxY * ext.getHeight()) / (h / scale);
244

    
245
                this.center = new Point2D.Double(wcX, wcY);
246
                repaint();
247
        }
248
        
249
        /**
250
         * Asigna una capa gr?fica
251
         * @param layer IGraphicLayer
252
         */
253
        public void setGraphicLayer(IGraphicLayer layer) {
254
                graphicLayers.add(layer);
255
        }
256
        
257
        /**
258
         * Obtiene la lista de capas gr?ficas
259
         * @return
260
         */
261
        public List<IGraphicLayer> getGraphicLayers() {
262
                return graphicLayers;
263
        }
264
        
265
        /**
266
         * Asigna la escala para el nuevo zoom
267
         * @param scale
268
         */
269
        public void setZoom(double scale) {
270
                this.scale = scale;
271
                repaint();
272
        }
273
        
274
        /**
275
         * Obtiene la escala aplicada en el dibujado
276
         * @return double
277
         */
278
        public double getZoom() {
279
                return scale;
280
        }
281
        
282
        /**
283
         * Obtiene el extent actual asignado al canvas
284
         * @return Rectangle2D
285
         */
286
        public Rectangle2D getCanvasExtent() {
287
                return lastExtent;
288
        }
289
        
290
        /**
291
         * Asigna el extent del canvas
292
         * @param r
293
         */
294
        public void setCanvasExtent(Rectangle2D r) {
295
                this.lastExtent = r;
296
        }
297
        
298
        /**
299
         * Obtiene el tama?o de pixel
300
         * @return double
301
         */
302
        public double getPixelSize() {
303
                return pixelSize;
304
        }
305
        
306
        /**
307
         * Obtiene el centro del canvas
308
         * @return Point2D
309
         */
310
        public Point2D getCenter() {
311
                return center;
312
        }
313
        
314
        /**
315
         * Obtiene el buffer de la vista activa y lo dibuja sobre el panel
316
         * con los datos de escala y desplazamiento seleccionados.
317
         */
318
        protected void paintComponent(Graphics g) {
319
                if(image == null)
320
                        return;
321
                
322
                if(viewListener != null)
323
                        viewListener.startDraw(viewEvent);
324
                
325
                int w = getVisibleRect().width;
326
                int h = getVisibleRect().height;
327
                Rectangle2D ext = getCanvasExtent(w, h, scale);
328
                
329
                if(lastImage == null || !equal(lastExtent, ext)) { 
330
                        lastImage = new BufferedImage((int)w, (int)h, BufferedImage.TYPE_INT_ARGB);
331
                        lastImageWithLayers = new BufferedImage((int)w, (int)h, BufferedImage.TYPE_INT_RGB);
332
                } else if(!panAT.isIdentity()) {
333
                        //Cuando se hace un Pan se dibuja el fondo y un imagen superpuesta transparente
334
                        g.drawImage(lastImageWithLayers, 0, 0, null);
335
                        ((Graphics2D)g).transform(panAT);
336
                        AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.4f);
337
                        ((Graphics2D)g).setComposite(composite);
338
                        g.drawImage(lastImage, 0, 0, null);
339
                        return;
340
                }
341

    
342
                if(clear) {
343
                        g.setColor(backgroundColor);
344
                        g.fillRect(0, 0, w, h);
345
                        return;
346
                }
347
                
348
                //Dibujamos el buffer sobre el grafics
349
                Graphics graphicsDB = draw(ext, w, h);        
350
                                
351
                //Dibujamos todas las capas registradas
352
                for (int i = 0; i < graphicLayers.size(); i++) 
353
                        ((IGraphicLayer)graphicLayers.get(i)).draw((Graphics2D)graphicsDB, ext, w, h);
354
                
355
                lastExtent = ext;
356
                
357
                if(selectedTool != null)
358
                        selectedTool.draw(graphicsDB);
359
                        
360
                if(showInfo)
361
                        showInfo(graphicsDB);
362
                                
363
                g.drawImage(lastImageWithLayers, 0, 0, this);
364
                graphicsDB.dispose();
365
                
366
                if(viewListener != null)
367
                        viewListener.endDraw(viewEvent);
368
        }
369
        
370
        /**
371
         * Muestra informaci?n sobre la vista
372
         * @param g
373
         */
374
        private void showInfo(Graphics g) {
375
                g.setColor(textColor);
376
                g.drawString("X: " + clipDecimals(realCoord.getX(), 3), 12, 18);
377
                g.drawString("Y: " + clipDecimals(realCoord.getY(), 3), 12, 32);
378
        }
379
        
380
        public double clipDecimals(double num, int n) {
381
                long m = (long) Math.pow(10, n);
382
                long aux = Math.round(num * m);
383
                return (double) aux / (double) m;
384
        }
385
        
386
        /**
387
         * Compara dos extents y devuelve true si son iguales y false si son distintos
388
         * @param e1 Extent 1
389
         * @param e2 Extent 2
390
         * @return true si son iguales y false si son diferentes
391
         */
392
        private boolean equal(Rectangle2D e1, Rectangle2D e2) {
393
                return (e1 != null && e2 != null && e1.getMinX() == e2.getMinX() && e1.getMinY() == e2.getMinY() 
394
                                && e1.getMaxX() == e2.getMaxX() && e1.getMaxY() == e2.getMaxY());
395
        }
396
        
397
        /**
398
         * Obtiene el Extent del canvas. Este canvas tiene un ancho en pixeles
399
         * de w y un alto de h. Tiene en cuenta la escala a la que se quiere dibujar
400
         * para devolver el extent cuando el zoom ya est? aplicado.
401
         * @param w Ancho del canvas en p?xeles
402
         * @param h Alto del canvas en p?xeles
403
         * @return Rectangle2D
404
         */
405
        private Rectangle2D getCanvasExtent(double w, double h, double scale) {
406
                double tW = ((w / scale) / 2) * pixelSize;
407
                double tH = ((h / scale) / 2) * pixelSize;
408
                double minX = center.getX() - tW;
409
                double minY = center.getY() - tH;
410
                double width = Math.abs((center.getX() + tW) - minX);
411
                double height = Math.abs((center.getY() + tH) - minY);
412
                return new Rectangle2D.Double(minX, minY, width, height);
413
        }
414
        
415
        /**
416
         * <P>
417
         * Dibujado del buffer de datos sobre el Graphics. 
418
         * </P><P>
419
         * No podemos aplicar un escalado al
420
         * Graphics y dibujar porque cuando el zoom es mayor a 1 los pixeles no empiezan a dibujarse
421
         * siempre en la esquina superior izquierda y al Graphics solo podemos ordenarle el dibujado
422
         * en coordenadas enteras. Para solucionarlo debemos copiar el trozo de buffer a dibujar teniendo
423
         * en cuenta el desplazamiento de la esquina superior izquierda de un pixel.
424
         * </P> 
425
         * @param g
426
         * @param ext
427
         * @param w
428
         * @param h
429
         */
430
        private Graphics draw(Rectangle2D ext, double w, double h) {
431
                if(!equal(lastExtent, ext)  || forceRequest) {                        
432
                        //Hallamos la coordenada pixel del buffer de la esquina superior izquierda del extent
433
                        double pxX = ((ext.getMinX() - extent.getMinX()) * (w / scale)) / ext.getWidth();
434
                        double pxY = ((extent.getMinY() - ext.getMinY()) * (h / scale)) / ext.getHeight();
435

    
436
                        //Creamos el buffer y lo cargamos teniendo en cuenta el desplazamiento inicial
437
                        double step = 1 / scale;
438

    
439
                        double xValue = pxX;
440
                        double yValue = pxY;
441

    
442
                        for (int i = 0; i < w; i++) {
443
                                yValue = pxY;
444
                                for (int j = 0; j < h; j++) {
445
                                        if((int)xValue >= 0 && (int)yValue >= 0 && (int)xValue < image.getWidth() && (int)yValue < image.getHeight()) {
446
                                                lastImage.setRGB(i, j, image.getRGB((int)xValue, (int)yValue));
447
                                                lastImageWithLayers.setRGB(i, j, image.getRGB((int)xValue, (int)yValue));
448
                                        } else {
449
                                                lastImage.setRGB(i, j, 0xffffffff);
450
                                                lastImageWithLayers.setRGB(i, j, 0xffffffff);
451
                                        }
452
                                        yValue += step;
453
                                }
454
                                xValue += step;
455
                        }
456
                        if(viewListener != null)
457
                                viewListener.zoomViewChanged(viewEvent);
458
                        forceRequest = false;
459
                } else 
460
                        ((Graphics2D)lastImageWithLayers.getGraphics()).drawImage(lastImage, 0, 0, null);
461
                
462
                return lastImageWithLayers.getGraphics();
463
        }
464

    
465
        /*
466
         * (non-Javadoc)
467
         * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
468
         */
469
        public void mouseClicked(MouseEvent e) {
470
                for (int i = 0; i < graphicLayers.size(); i++) 
471
                        ((IGraphicLayer)graphicLayers.get(i)).mouseClicked(e);
472
                repaint();
473
        }
474

    
475
        /*
476
         * (non-Javadoc)
477
         * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
478
         */
479
        public void mouseEntered(MouseEvent e) {
480
                for (int i = 0; i < graphicLayers.size(); i++) 
481
                        ((IGraphicLayer)graphicLayers.get(i)).mouseEntered(e);
482
                repaint();
483
        }
484

    
485
        /*
486
         * (non-Javadoc)
487
         * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
488
         */
489
        public void mouseExited(MouseEvent e) {
490
                for (int i = 0; i < graphicLayers.size(); i++) 
491
                        ((IGraphicLayer)graphicLayers.get(i)).mouseExited(e);
492
                repaint();
493
        }
494

    
495
        /*
496
         * (non-Javadoc)
497
         * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
498
         */
499
        public void mousePressed(MouseEvent e) {
500
                for (int i = 0; i < graphicLayers.size(); i++) 
501
                        ((IGraphicLayer)graphicLayers.get(i)).mousePressed(e);
502
                repaint();
503
        }
504

    
505
        /*
506
         * (non-Javadoc)
507
         * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
508
         */
509
        public void mouseReleased(MouseEvent e) {
510
                for (int i = 0; i < graphicLayers.size(); i++) 
511
                        ((IGraphicLayer)graphicLayers.get(i)).mouseReleased(e);
512
                repaint();
513
        }
514

    
515
        /*
516
         * (non-Javadoc)
517
         * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
518
         */
519
        public void mouseDragged(MouseEvent e) {
520
                for (int i = 0; i < graphicLayers.size(); i++) 
521
                        ((IGraphicLayer)graphicLayers.get(i)).mouseDragged(e);
522
                repaint();
523
        }
524

    
525
        /*
526
         * (non-Javadoc)
527
         * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
528
         */
529
        public void mouseMoved(MouseEvent e) {
530
                realCoord = viewCoordsToWorld((Point2D)e.getPoint());
531
                //viewCoord = e.getPoint();
532
                for (int i = 0; i < graphicLayers.size(); i++) 
533
                        ((IGraphicLayer)graphicLayers.get(i)).mouseMoved(e);
534
                repaint();
535
        }
536

    
537
        /**
538
         * Asigna la tool seleccionada
539
         * @param selectedTool
540
         */
541
        public void setSelectedTool(BaseViewTool selectedTool) {
542
                this.selectedTool = selectedTool;
543
        }
544
        
545
        /**
546
         * Obtiene la herramienta seleccionada
547
         * @return BaseViewTool
548
         */
549
        public BaseViewTool getSelectedTool() {
550
                return selectedTool;
551
        }
552

    
553
        /**
554
         * Activa o desactiva el mostrado de informaci?n
555
         * @param showInfo
556
         */
557
        public void setShowInfo(boolean showInfo) {
558
                this.showInfo = showInfo;
559
        }
560
        
561
        /**
562
         * Asigna el valor para el flag minxMaxyUL. Este flag informa de que la esquina 
563
         * superior izquierda corresponde con el valor de m?nimo X y m?ximo Y. En caso 
564
         * de ser false esta esquina ser?a de m?nimo X y m?nimo Y.
565
         * @param v
566
         */
567
        public void setMinxMaxyUL(boolean v) {
568
                this.minxMaxyUL = v;
569
        }
570
        
571
        /**
572
         * Obtiene el valor para el flag minxMaxyUL. Este flag informa de que la esquina 
573
         * superior izquierda corresponde con el valor de m?nimo X y m?ximo Y. En caso 
574
         * de ser false esta esquina ser?a de m?nimo X y m?nimo Y.
575
         * @param v
576
         */
577
        public boolean getMinxMaxyUL() {
578
                return minxMaxyUL;
579
        }
580

    
581
        /**
582
         * Asigna el color del texto
583
         * @param textColor
584
         */
585
        public void setTextColor(Color textColor) {
586
                this.textColor = textColor;
587
                repaint();
588
        }
589

    
590
        /**
591
         * Obtiene el color del texto
592
         * @return
593
         */
594
        public Color getTextColor() {
595
                return textColor;
596
        }
597

    
598
        /**
599
         * Obtiene el color de fondo
600
         * @return
601
         */
602
        public Color getBackgroundColor() {
603
                return backgroundColor;
604
        }
605

    
606
        /**
607
         * Asigna el color de fondo
608
         * @param backgroundColor
609
         */
610
        public void setBackgroundColor(Color backgroundColor) {
611
                this.backgroundColor = backgroundColor;
612
        }
613

    
614
        /**
615
         * Normalmente no se hace una petici?n al dibujado del raster si el extent no ha variado. Si esta variable
616
     * est? a true fuerza que haya una petici?n de redibujado aunque el extent del raster no haya cambiado.
617
     * Esto solo se hace para una petici?n. La siguiente vuelve a estar a false.
618
         * @return
619
         */
620
        public boolean isForceRequest() {
621
                return forceRequest;
622
        }
623

    
624
        /**
625
         * Normalmente no se hace una petici?n al dibujado del raster si el extent no ha variado. Si esta variable
626
     * est? a true fuerza que haya una petici?n de redibujado aunque el extent del raster no haya cambiado.
627
     * Esto solo se hace para una petici?n. La siguiente vuelve a estar a false.
628
         * @param forceRequest
629
         */
630
        public void setForceRequest(boolean forceRequest) {
631
                this.forceRequest = forceRequest;
632
        }
633
        
634
        /*public BufferedImage getLastBufferedImage() {
635
                return lastImage;
636
        }*/
637
        
638
        public AffineTransform getAffineTransform() {
639
                return panAT;
640
        }
641
}