Revision 11034

View differences:

branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/MapControl.java
45 45
import java.awt.Dimension;
46 46
import java.awt.Graphics;
47 47
import java.awt.Graphics2D;
48
import java.awt.GraphicsEnvironment;
49 48
import java.awt.event.ActionEvent;
50 49
import java.awt.event.ActionListener;
51 50
import java.awt.event.ComponentEvent;
......
58 57
import java.awt.geom.Point2D;
59 58
import java.awt.geom.Rectangle2D;
60 59
import java.awt.image.BufferedImage;
60
import java.util.Date;
61 61
import java.util.HashMap;
62 62
import java.util.Set;
63 63

  
......
339 339
	 */
340 340
	protected void paintComponent(Graphics g) {
341 341
        adaptToImageSize();
342
        /* if (status == FAST_PAINT) {
343
            System.out.println("FAST_PAINT");
344
            g.drawImage(image,0,0,null);
345
            status = ACTUALIZADO;
346
            return;
347
        } */
348
        // System.out.println("PINTANDO MAPCONTROL" + this);
349
		if (status == ACTUALIZADO) {
350
			// LWS logger.debug("Dibujando la imagen obtenida");
351

  
342
      	if (status == ACTUALIZADO) {
352 343
			/*
353 344
			 * Si hay un behaviour y la imagen es distinta de null se delega el dibujado
354 345
			 * en dicho behaviour
......
359 350
                    currentMapTool.paintComponent(g);
360 351
                else
361 352
                    g.drawImage(image,0,0,null);
362

  
363
				// System.out.println("Pinto ACTUALIZADO");
364 353
			}
365 354
		} else if ((status == DESACTUALIZADO)
366 355
                || (status == ONLY_GRAPHICS)) {
367
			// LWS System.out.println("DESACTUALIZADO: Obteniendo la imagen de la cartograf?a");
368
			/* if (isOpaque())
369
			{
370
			    if (image==null)
371
			    {
372
			        g.setColor(vp.getBackColor());
373
			        g.fillRect(0,0,getWidth(), getHeight());
374
			    }
375
			    // else g.drawImage(image,0,0,null);
376
			} */
377
            // cancelDrawing();
378
			//Se crea la imagen con el color de fonde deseado
379
			/* if (image == null)
380
			{
381
				image = new BufferedImage(this.getWidth(), this.getHeight(),
382
						BufferedImage.TYPE_INT_ARGB);
383
				vp.setImageSize(new Dimension(getWidth(), getHeight()));
384
				Graphics gTemp = image.createGraphics();
385
			    Color theBackColor = vp.getBackColor();
386
			    if (theBackColor == null)
387
			        gTemp.setColor(Color.WHITE);
388
			    else
389
			        gTemp.setColor(theBackColor);
390 356

  
391
				gTemp.fillRect(0,0,getWidth(), getHeight());
392
				gTemp.dispose();
393
				// g.drawImage(image,0,0,null);
394
				System.out.println("Imagen con null en DESACTUALIZADO. Width = " + this.getWidth());
395
			} */
396
            // else
397
            // {
398

  
399

  
400
            // if (image != null)
401
            //  {
402 357
                g.drawImage(image,0,0,null);
403 358

  
404 359
                drawer2.put(new PaintingRequest());
405 360
                timer.start();
406
            /* }
407
            else
408
                return; */
409
            // }
410

  
411
            /* if (drawerAlive == false)
412
            {
413
                drawer = new Drawer(image, canceldraw);
414
                drawer.start();
415
			//Se lanza el tread de dibujado
416
            } */
417

  
418
			// status = ACTUALIZADO;
419
		}
361
       }
420 362
	}
421 363

  
422 364
	/**
......
435 377
	 */
436 378
	public void drawMap(boolean doClear) {
437 379
		cancelDrawing();
438
		System.out.println("drawMap con doClear=" + doClear);
439
        status = DESACTUALIZADO;
380
		status = DESACTUALIZADO;
440 381
        getMapContext().getLayers().setDirty(true);
441 382
		if (doClear)
442 383
        {
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLayers.java
608 608
    					long t2 = System.currentTimeMillis();
609 609
    					System.out.println("Layer " + lyr.getName() + " "
610 610
    					        + (t2-t1) + " milisecs.");
611
    					lyr.setDirty(false);
611
    					if (!cancel.isCanceled())
612
    						lyr.setDirty(false);
612 613
    			}
613 614
    			LayerDrawEvent afterEvent = new LayerDrawEvent(lyr, g, viewPort, LayerDrawEvent.LAYER_AFTER_DRAW);
614 615
    			fmap.fireLayerDrawingEvent(afterEvent);
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/ShpStrategy.java
69 69
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
70 70
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
71 71
import com.iver.cit.gvsig.fmap.layers.SpatialCache;
72
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
73 72
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
74 73
import com.iver.cit.gvsig.fmap.layers.layerOperations.Selectable;
75 74
import com.iver.cit.gvsig.fmap.layers.layerOperations.SingleLayer;
76
import com.iver.cit.gvsig.fmap.rendering.ClassifiedLegendInfo;
77 75
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend;
78 76
import com.iver.utiles.swing.threads.Cancellable;
79 77
import com.iver.utiles.swing.threads.CancellableMonitorable;
......
132 130
			VectorialLegend l = (VectorialLegend) ((ClassifiableVectorial) getCapa())
133 131
					.getLegend();
134 132

  
135
			if (l instanceof ClassifiedLegendInfo) {
136
				ClassifiedLegendInfo clsfLegend = (ClassifiedLegendInfo) l;
137
				ISymbol[] symbs = clsfLegend.getSymbols();
138
				// double rSym = 0;
139
				// double maxRSym = -1;
133
//			if (l instanceof ClassifiedLegendInfo) {
134
//				ClassifiedLegendInfo clsfLegend = (ClassifiedLegendInfo) l;
135
//				ISymbol[] symbs = clsfLegend.getSymbols();
136
//				// double rSym = 0;
137
//				// double maxRSym = -1;
138
//
139
//				for (int i = 0; i < symbs.length; i++) {
140
//					// TODO: REVISAR LOS SIMBOLOS Y SUS TAMA?OS
141
//
142
//					/*
143
//					 * Style2D pointSymbol = symbs[i].getPointStyle2D(); if
144
//					 * (pointSymbol instanceof MarkStyle2D) { MarkStyle2D mrk2D =
145
//					 * (MarkStyle2D) pointSymbol; rSym =
146
//					 * viewPort.toMapDistance(mrk2D.getSize()); if (maxRSym <
147
//					 * rSym) maxRSym = rSym; }
148
//					 */
149
//				}
150
//			}
140 151

  
141
				for (int i = 0; i < symbs.length; i++) {
142
					// TODO: REVISAR LOS SIMBOLOS Y SUS TAMA?OS
143

  
144
					/*
145
					 * Style2D pointSymbol = symbs[i].getPointStyle2D(); if
146
					 * (pointSymbol instanceof MarkStyle2D) { MarkStyle2D mrk2D =
147
					 * (MarkStyle2D) pointSymbol; rSym =
148
					 * viewPort.toMapDistance(mrk2D.getSize()); if (maxRSym <
149
					 * rSym) maxRSym = rSym; }
150
					 */
151
				}
152
			}
153

  
154 152
			Rectangle2D extent = viewPort.getAdjustedExtent();
155 153
			// AffineTransform at = viewPort.getAffineTransform();
156 154

  
......
160 158

  
161 159
			long t1 = System.currentTimeMillis();
162 160
			// logger.debug("getCapa().getRecordset().start()");
163
			
161

  
164 162
			//CHEMA
165 163
			// En teorioa el al hacer el adapter.start()
166 164
			// deja abierta las fuentes de datos
167 165
			// geometrica y alfanumerica (cuando no son la misma
168
			// excepto cuando se ha hecho una operacion de 'join' de la tabla 
166
			// excepto cuando se ha hecho una operacion de 'join' de la tabla
169 167
			// (join de las tablas de gvsig(gdbms) no join de sql), entoces
170 168
			// el origen alfanumerico no es el mismo en el source
171 169
			// que en la capa.
......
236 234
				auxBI = new BufferedImage(image.getWidth(), image.getHeight(),
237 235
						image.getType());
238 236
			}
239

  
240 237
			for (int aux = 0; aux < sc; aux++) {
241 238
				// Salimos si alguien cancela
239

  
242 240
				if (cancel != null) {
243 241
					// azabala (por si acaso, al arreglar bug de process)
244 242
					if (cancel.isCanceled()) {
245
						break;
243
						return;
246 244
					}
247 245
				}
248 246
				if (bUseSpatialIndex) {
......
276 274
						// geom = ShapeFactory.createPolygon2D(new
277 275
						// GeneralPathX(bounds));
278 276

  
279
						
277

  
280 278
						//JMVIVO: OJO, No colnamos siempre porque
281 279
						// el FGeometry.drawInt (a diferencia del
282 280
						// FGeometry.draw) clona siempre la geometria
......
342 340
			// logger.debug("getCapa().getRecordset().stop()");
343 341
			//CHEMA
344 342
			// Cerramos la fuente alfanumerica cuando se ha hecho
345
			// una operacion de 'join'			
343
			// una operacion de 'join'
346 344
			//((FLyrVect) getCapa()).getSource().getRecordset().stop();
347 345
			if (lyr.isJoined()){
348 346
				lyr.getRecordset().stop();
......
420 418

  
421 419
			long t1 = System.currentTimeMillis();
422 420
			// logger.debug("getCapa().getRecordset().start()");
423
			
421

  
424 422
			//CHEMA
425 423
			// En teorioa el al hacer el adapter.start()
426 424
			// deja abierta las fuentes de datos
427 425
			// geometrica y alfanumerica (cuando no son la misma
428
			// excepto cuando se ha hecho una operacion de 'join' de la tabla 
426
			// excepto cuando se ha hecho una operacion de 'join' de la tabla
429 427
			// (join de las tablas de gvsig(gdbms) no join de sql), entoces
430 428
			// el origen alfanumerico no es el mismo en el source
431 429
			// que en la capa.
......
435 433
				lyr.getRecordset().start();
436 434
			}
437 435
			//CHEMA
438
			
439
			
436

  
437

  
440 438
			// TODO: A revisar si es o no conveniente este sistema
441 439
			// de comunicaci?n con los drivers.
442 440
			DriverAttributes attr = adapter.getDriverAttributes();
......
495 493
					// PRUEBA DE VELOCIDAD
496 494
					// geom = ShapeFactory.createPolygon2D(new
497 495
					// GeneralPathX(bounds));
498
					
496

  
499 497
					// JMVIVO: Clonamos siempre que sea necesario y no
500 498
					// solo si hay que reproyectar. Porque el FGeometry.draw
501 499
					// va a aplicar la transformacion sobre la geometria original
......
514 512
			// logger.debug("getCapa().getRecordset().stop()");
515 513
			//CHEMA
516 514
			// Cerramos la fuente alfanumerica cuando se ha hecho
517
			// una operacion de 'join'			
515
			// una operacion de 'join'
518 516
			//((FLyrVect) getCapa()).getSource().getRecordset().stop();
519 517
			if (lyr.isJoined()){
520 518
				lyr.getRecordset().stop();

Also available in: Unified diff