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 @ 1752

History | View | Annotate | Download (19.3 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
    
102
    /**
103
         * Asigna los par?metros de dibujado
104
         * @param img Buffer con un ?rea de datos
105
         * @param ext Rectangle2D del ?rea de datos dada 
106
         * @param pixelSize Tama?o de pixel
107
         * @param center Punto del ?rea de datos donde se quiere centrar el dibujado del buffer
108
         */
109
        public void setDrawParams(BufferedImage img, Rectangle2D ext, double pixelSize, Point2D center) {
110
                this.image = img;
111
                this.extent = ext;
112
                this.pixelSize = pixelSize;
113
                this.center = center;
114
                this.addMouseListener(this);
115
                this.addMouseMotionListener(this);
116
                repaint();
117
        }
118
        
119
        /**
120
         * Asigna el listener de eventos de la vista
121
         * @param listener
122
         */
123
        public void setViewListener(ViewListener listener) {
124
                this.viewListener = listener;
125
                viewEvent = new ViewEvent(this);
126
        }
127
        
128
        /**
129
         * Asigna un nuevo centro de visualizaci?n
130
         * @param center
131
         */
132
        public void setCenter(Point2D center) {
133
                this.center = center;
134
                repaint();
135
        }
136
        
137
        /**
138
         * Conversi?n de un punto en coordenadas del canvas a reales
139
         * @param p
140
         * @return
141
         */
142
        public Point2D viewCoordsToWorld(Point2D p) {
143
                int w = getVisibleRect().width;
144
                int h = getVisibleRect().height;
145
                double cx = extent.getMinX() + ((p.getX() * extent.getWidth()) / w);
146
                double cy = 0;
147
                if(minxMaxyUL) //Cuando las Y decrecen de arriba a abajo
148
                        cy = extent.getMaxY() - (p.getY() * extent.getHeight()) / h;
149
                else //Cuando las Y crecen de arriba a abajo
150
                        cy = extent.getMinY() + (p.getY() * extent.getHeight()) / h;
151
                return new Point2D.Double(cx, cy);
152
        }
153
        
154
        /**
155
         * Conversi?n de un punto en coordenadas del canvas a reales
156
         * @param p
157
         * @return
158
         */
159
        public Point2D viewCoordsFromWorld(Point2D p) {
160
                int w = getVisibleRect().width;
161
                int h = getVisibleRect().height;
162
                double cx = ((p.getX() - extent.getMinX()) * w) / extent.getWidth();
163
                double cy = 0;
164
                if(minxMaxyUL) //Cuando las Y decrecen de arriba a abajo
165
                        cy = ((extent.getMaxY() - p.getY()) * h) / extent.getHeight();
166
                else //Cuando las Y crecen de arriba a abajo
167
                        cy = ((p.getY() - extent.getMinY()) * h) / extent.getHeight();
168
                return new Point2D.Double(cx, cy);
169
        }
170
        
171
        /**
172
         * Obtiene el extent del canvas en coordenadas del mundo real
173
         * @return Rectangle2D
174
         */
175
        public Rectangle2D getExtent() {
176
                if(lastExtent == null)
177
                        return extent;
178
                return lastExtent;
179
        }
180
        
181
        /**
182
         * Asigna un nuevo centro de visualizaci?n en coordenadas del
183
         * componente.
184
         * @param center
185
         */
186
        public void setViewCenter(Point2D c) {
187
                int w = getVisibleRect().width;
188
                int h = getVisibleRect().height;
189
                
190
                double cx = (c.getX() * lastExtent.getWidth()) / w;
191
                double cy = (c.getY() * lastExtent.getHeight()) / h;
192
                setPixelCenter(new Point2D.Double(cx, cy));
193
        }
194
        
195
        /**
196
         * Asigna un nuevo centro de visualizaci?n en coordenadas pixel
197
         * del ?rea de dibujado (canvas). El nuevo centro ser? calculado en coordenadas
198
         * del mapa.
199
         * @param center
200
         */
201
        public void setPixelCenter(Point2D c) {
202
                int w = getVisibleRect().width;
203
                int h = getVisibleRect().height;
204
                
205
                //Calculamos el extent del canvas 
206
                Rectangle2D ext = getCanvasExtent(w, h, scale);
207
                
208
                //Calculamos el nuevo centro en coordenadas reales
209
                double wWC = (c.getX() / scale) * pixelSize;
210
                double hWC = (c.getY() / scale) * pixelSize;
211
                this.center = new Point2D.Double(ext.getMinX() + wWC,
212
                                                                                 ext.getMinY() - hWC);
213
                repaint();
214
        }
215
        
216
        /**
217
         * Asigna un nuevo centro de visualizaci?n en coordenadas pixel. Esta llamada tiene
218
         * en cuenta solo p?xeles completos. No centra sobre porciones de pixel cuando el zoom es
219
         * mayor de 1:1. El nuevo centro es en coordenadas del mapa pero siempre centrar?
220
         * en la esquina inferior izquierda del pixel.
221
         * @param center
222
         */
223
        public void setPixelCenter(int x, int y) {
224
                int w = getVisibleRect().width;
225
                int h = getVisibleRect().height;
226
                
227
                //Calculamos el extent del canvas 
228
                Rectangle2D ext = getCanvasExtent(w, h, scale);
229
                
230
                //Calculamos el nuevo centro en coordenadas reales
231
                double wWC = (x / scale) * pixelSize;
232
                double hWC = (y / scale) * pixelSize;
233
                Point2D center = new Point2D.Double(ext.getMinX() + wWC,
234
                                                                                          ext.getMinY() - hWC);
235
                
236
                //Calculamos la coordena pixel a la que pertenece esa coordenada real
237
                int pxX = (int)((center.getX() * (w / scale)) / ext.getWidth());
238
                int pxY = (int)((center.getY() * (h / scale)) / ext.getHeight());
239
                
240
                //Despu?s de haber convertido a pixel y redondeado la coordenada a entero volvemos a convertirla en real
241
                double wcX = (pxX * ext.getWidth()) / (w / scale);
242
                double wcY = (pxY * ext.getHeight()) / (h / scale);
243

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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