Revision 980

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/DefaultStrategy.java
3 3

  
4 4
import java.awt.Graphics2D;
5 5
import java.awt.geom.AffineTransform;
6
import java.awt.geom.Point2D;
6 7
import java.awt.geom.Rectangle2D;
7 8
import java.awt.image.BufferedImage;
8 9
import java.util.BitSet;
......
51 52
	 */
52 53
	public BitSet queryByRect(Rectangle2D rect) throws DriverException {
53 54
		QueryByRectVisitor visitor = new QueryByRectVisitor();
55
		ICoordTrans ct = getCapa().getCoordTrans();
56
    	if (ct != null)
57
    	{    		
58
    		rect = ct.getInverted().convert(rect);
59
    	}				
60

  
54 61
		visitor.setRect(rect);
55 62
		try{
56 63
			process(visitor);
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/ViewPort.java
50 50
	private ArrayList colorListeners = new ArrayList();
51 51
	private Point2D offset = new Point2D.Double(0, 0);
52 52
	private Rectangle2D clip;
53
	private Color backColor = Color.WHITE;
53
	private Color backColor = null; //Color.WHITE;
54 54
	private IProjection proj;
55 55
	private double dist1pixel;
56 56
	private double dist3pixel;
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/PanListenerImpl.java
43 43
	 */
44 44
	public void move(MoveEvent event) {
45 45
		ViewPort vp = mapControl.getMapContext().getViewPort();
46
		System.out.println(vp);
46
		// System.out.println(vp);
47 47
		Point2D from=vp.toMapPoint(event.getFrom());
48 48
		Point2D to=vp.toMapPoint(event.getTo());
49 49
		
......
55 55
         r.height = extent.getHeight();
56 56
         vp.setExtent(r);
57 57
         
58
         mapControl.drawMap();
58
         // mapControl.drawMap();
59 59
	}
60 60

  
61 61

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/FMap.java
398 398
	public void draw(BufferedImage image, Graphics2D g, Cancellable cancel)
399 399
		throws DriverException {
400 400
		if (viewPort.getExtent() == null) {
401
			System.err.println("viewPort.getExtent() = null");
401
			// System.err.println("viewPort.getExtent() = null");
402 402
			return;
403 403
		}
404
		System.out.println("Viewport despues: " + viewPort); 
404
		// System.out.println("Viewport despues: " + viewPort); 
405 405
		/* if ((viewPort.getImageWidth() <=0) || (viewPort.getImageHeight() <= 0))
406 406
		{
407 407
			return;
......
412 412

  
413 413
		layers.draw(image, g, viewPort, cancel);
414 414
		
415
		g.setColor(Color.BLUE);
415
		/* g.setColor(Color.BLUE);
416 416
		GeneralPath shpR = new GeneralPath(viewPort.getExtent());
417 417
		shpR.transform(viewPort.getAffineTransform());
418
		g.draw(shpR);
418
		g.draw(shpR); */
419 419
	}
420 420

  
421 421
	/**
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/NewMapControl.java
1 1
package com.iver.cit.gvsig.fmap;
2 2

  
3
import java.awt.Color;
3 4
import java.awt.Dimension;
4 5
import java.awt.Graphics;
5 6
import java.awt.Graphics2D;
......
48 49
    private MapTool currentMapTool = null;
49 50
    private int status = ACTUALIZADO;
50 51
    private BufferedImage image = null;
51
    private BufferedImage backimage = null;
52 52
    private String currentTool;
53 53
    private CancelDraw canceldraw;
54 54
    private boolean isCancelled = true;
......
110 110
        }else{
111 111
        	vp = mapContext.getViewPort();
112 112
        	// vp.setImageSize(new Dimension(getWidth(), getHeight()));
113
        	System.err.println("Viewport en setMapContext:" + vp);
113
        	// System.err.println("Viewport en setMapContext:" + vp);
114 114
        }
115 115

  
116 116
        mapContext.addAtomicEventListener(mapContextListener);
......
217 217
     * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
218 218
     */
219 219
    protected void paintComponent(Graphics g) {
220
    	if (image == null) return;
220 221
      if (status == ACTUALIZADO) {
221 222
        logger.debug("Dibujando la imagen obtenida");
222
            if (image != null) {
223
                g.drawImage(image, 0, 0,vp.getBackColor(), this);
224
            } else {
223
        System.out.println("Dibujando la imagen obtenida" + System.currentTimeMillis());
224
            /* else {
225 225
                image = new BufferedImage(this.getWidth(), this.getHeight(),
226 226
                        BufferedImage.TYPE_INT_ARGB);
227
            }
227
            } 
228
            */
229
            if (currentMapTool != null) {
230
                currentMapTool.paintComponent(g); 
231
            } 
232
            /* else if (image != null) {
233
                g.drawImage(image, 0, 0,vp.getBackColor(), this);
234
            } */
228 235

  
229
            if (currentMapTool != null) {
230
                currentMapTool.paintComponent(g);
231
            }
232 236
        } else if (status == DESACTUALIZADO) {
233 237
        	logger.debug("Obteniendo la imagen de la cartograf?a");
234
        	if (backimage !=null){
235
        	g.drawImage(backimage,0,0,vp.getBackColor(),this);
236
        	}
237
        	image = new BufferedImage(this.getWidth(), this.getHeight(),
238
                        BufferedImage.TYPE_INT_ARGB);
238
            
239
            g.setColor(vp.getBackColor());
240
            g.fillRect(0, 0, getWidth(), getHeight());
239 241
         
240 242
            cancelDrawing();
241

  
242
            drawer = new Drawer(image, (Graphics2D) image.getGraphics(),
243
            if (image != null)
244
            {
245
            	drawer = new Drawer(image, (Graphics2D) image.getGraphics(),
243 246
                    canceldraw);
244
            drawer.start();
245
            timer.start();
246
            status = ACTUALIZADO;
247
            	drawer.start();
248
            	timer.start();
249
            	status = ACTUALIZADO;
250
            }
247 251
        }
248 252
        
249 253
    }
......
262 266
     */
263 267
    public void drawMap() {
264 268
        status = DESACTUALIZADO;
265
        vp.setImageSize(new Dimension(getWidth(), getHeight()));
266
        backimage=new BufferedImage(this.getWidth(), this.getHeight(),
267
                BufferedImage.TYPE_INT_ARGB);
268
        backimage.setRGB(2,4,5);
269 269
        repaint();
270 270
    }
271 271

  
......
285 285
     * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
286 286
     */
287 287
    public void componentResized(ComponentEvent e) {
288
        vp.setImageSize(new Dimension(getWidth(), getHeight()));
289

  
290
    	image = new BufferedImage(this.getWidth(), this.getHeight(),
291
                BufferedImage.TYPE_INT_ARGB);
292
        image.getGraphics().setColor(vp.getBackColor());
293
        image.getGraphics().fillRect(0, 0, getWidth(), getHeight());
294
    	
288 295
        drawMap();
289 296
    }
290 297

  
......
316 323
            this.g = g;
317 324
            this.image = image;
318 325
            this.cancel = cancel;
326

  
319 327
        }
320 328

  
321 329
        /**
......
324 332
        public void run() {
325 333
            try {
326 334
                synchronized (Drawer.class) {
335
                	
327 336
                    mapContext.draw(image, (Graphics2D) image.getGraphics(),
328 337
                        cancel);
329 338
                    timer.stop();
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/DEMO/SingleView.java
494 494
        // jToolBar1.add(jTextField1);
495 495

  
496 496
		m_MapControl = new NewMapControl();
497
		m_MapControl.setBackground(new Color(255, 255, 255));
497

  
498
		m_MapControl.getMapContext().getViewPort().setBackColor(Color.RED);
498 499
		m_MapControl.addMouseListener(new MouseAdapter() {
499 500
				public void mousePressed(MouseEvent e) {
500 501
					/* if (m_MapControl.getTool() == MapControl.INFO) {

Also available in: Unified diff