Revision 11101

View differences:

branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLayers.java
431 431
   			///// CHEMA ComposedLayer
432 432
		    long tg1 = System.currentTimeMillis();
433 433
			ComposedLayer group = null;
434
			ArrayList pendingEvents= new ArrayList();        	
434
			ArrayList pendingEvents= new ArrayList();
435 435
        	boolean fireAfterDrawEvent = true;
436 436
   			///// CHEMA ComposedLayer
437 437

  
438
        	
439
        	
438

  
439

  
440 440
//    		while (iter.hasNext())
441 441
//    		{
442 442
    		 for (int i=0; i < layers.size(); i++) {
......
446 446
    			FLayer lyr = (FLayer) layers.get(i);
447 447

  
448 448

  
449
       			///// CHEMA ComposedLayer    			
449
       			///// CHEMA ComposedLayer
450 450
    			fireAfterDrawEvent = true;
451 451
    			///// CHEMA ComposedLayer
452
    			
453
    			
452

  
453

  
454 454
    		/*	if (lyr instanceof FLyrVect && ((FLyrVect)lyr).isBroken()){
455 455
    				continue;
456 456
    			}
......
497 497
    			        				group = null;
498 498
    			        			}
499 499
       			        			///// CHEMA ComposedLayer
500
       			        			
501 500

  
501

  
502 502
    			        			// Copiamos la imagen actual
503 503
    			        			BufferedImage buff = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
504 504
    			        			WritableRaster w = buff.getRaster();
......
516 516
	    			        			// prepareDrawing de FMap.
517 517
	    			        			if (lyr.isDirty())
518 518
	    			        			{
519
	    			        			
520
	    	   			        			
519

  
520

  
521 521
	    	   			        			///// CHEMA ComposedLayer
522 522
	    			        				// Checks for draw group (ComposedLayer)
523 523
	        			        			if (group != null) {
......
528 528
	        			        				group = null;
529 529
	        			        			}
530 530
	           			        			///// CHEMA ComposedLayer
531
	           			        			
532 531

  
532

  
533 533
	    			        				g.drawImage(lyr.getCacheImageDrawnLayers(), 0, 0, null);
534 534
	    			        				System.err.println("Pinto con acelerado lo que hab?a antes de " + lyr.getName());
535 535
	    			        			}
......
539 539
    			        	// Si la capa est? "sucia" o alguna de las de abajo est? sucia
540 540
    			        	// hay que volver a dibujar.
541 541
   			        		if (lyr.isDirty() || bNeedRecalculateCache)
542
   			        		{   			        			
542
   			        		{
543 543
   			        			if (!lyr.getFLayerStatus().isDriverLoaded())
544 544
   			        			{
545 545
   			        				continue;
546 546
   			        			}
547
   			        			
547

  
548 548
   			        			///// CHEMA ComposedLayer
549 549
   			        			//lyr.draw(image, g, viewPort, cancel,scale);
550 550
   			        			//bNeedRecalculateCache = true;
551 551
   			        			//System.err.println("Pinto sin acelerado " + lyr.getName());
552 552
   			        			///// CHEMA ComposedLayer
553
   			        			
553

  
554 554
   			        			///// CHEMA ComposedLayer
555 555
   			        			// Checks for draw group (ComposedLayer)
556 556
   			        			if (group != null) {
......
567 567

  
568 568
   		   			        			// gets a new group instance
569 569
   		   			        			group = lyr.newComposedLayer();
570
   		   			        			// if layer hasn't group, draws it inmediately 
570
   		   			        			// if layer hasn't group, draws it inmediately
571 571
   		   			        			if (group == null) {
572 572
   		   			        				lyr.draw(image, g, viewPort, cancel,scale);
573 573
   		   			        			} else {
......
580 580
   			        			} else {
581 581
	   			        			// gets a new group instance
582 582
	   			        			group = lyr.newComposedLayer();
583
	   			        			// if layer hasn't group, draws it inmediately 
583
	   			        			// if layer hasn't group, draws it inmediately
584 584
	   			        			if (group == null) {
585 585
	   			        				lyr.draw(image, g, viewPort, cancel,scale);
586 586
	   			        			} else {
......
615 615
    			fmap.fireLayerDrawingEvent(afterEvent);
616 616

  
617 617
    		}
618
    		///// CHEMA ComposedLayer 
618
    		///// CHEMA ComposedLayer
619 619
    		if (group != null) {
620
 				//si tenemos un grupo pendiente de pintar, pintamos    			 
620
 				//si tenemos un grupo pendiente de pintar, pintamos
621 621
 				group.draw(image, g, viewPort, cancel,scale);
622 622
				fireLayerDrawingEvents(pendingEvents);
623 623

  
624 624
 			}
625
			///// CHEMA ComposedLayer    		
625
			///// CHEMA ComposedLayer
626 626
    		if (getVirtualLayers() != null) {
627 627
    			getVirtualLayers().draw(image, g, viewPort, cancel,scale);
628 628
    		}
......
632 632
//            System.err.println(e.getMessage());
633 633
//        }
634 634
	}
635
	
635

  
636 636
	private void fireLayerDrawingEvents(Collection events) {
637 637
		Iterator iter = events.iterator();
638 638
		LayerDrawEvent afterEvent;
......
642 642
			fmap.fireLayerDrawingEvent(afterEvent);
643 643
		}
644 644
	}
645
	
645

  
646 646
	/**
647 647
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D,
648 648
	 * 		com.iver.cit.gvsig.fmap.ViewPort,
......
788 788
		xml.putProperty("LayerNames", s);
789 789

  
790 790
		for (int i = 0; i < layers.size(); i++) {
791
			try{
791 792
			xml.addChild(((FLayer) layers.get(i)).getXMLEntity());
793
			}catch (XMLException e) {
794
				e.printStackTrace();
795
			}
792 796
		}
793 797

  
794 798
		return xml;
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java
40 40
 */
41 41
package com.iver.cit.gvsig.fmap.layers;
42 42

  
43
import java.awt.Color;
44 43
import java.awt.Font;
45 44
import java.awt.Graphics2D;
46 45
import java.awt.Point;
......
734 733
			return this.orgXMLEntity;
735 734
		}
736 735
		XMLEntity xml = super.getXMLEntity();
737
		xml.addChild(getLegend().getXMLEntity());
736
		if (getLegend()!=null)
737
			xml.addChild(getLegend().getXMLEntity());
738 738
		try {
739
			xml.addChild(getRecordset().getSelectionSupport().getXMLEntity());
740

  
739
			if (getRecordset()!=null)
740
				xml.addChild(getRecordset().getSelectionSupport().getXMLEntity());
741 741
		} catch (DriverException e1) {
742 742
			e1.printStackTrace();
743 743
			throw new XMLException(e1);
744 744
		}
745 745
		//Repongo el mismo ReadableVectorial m?s abajo para cuando se guarda el proyecto.
746 746
		ReadableVectorial rv=getSource();
747
		if (getSource() instanceof VectorialEditableAdapter) {
748
			setSource(((VectorialEditableAdapter) source).getOriginalAdapter());
749
		}
750
		if (getSource() instanceof VectorialFileAdapter) {
751
			xml.putProperty("type", "vectorial");
752
			xml.putProperty("file", ((VectorialFileAdapter) getSource())
753
					.getFile());
754
			// try {
755
			try {
756
				xml.putProperty("recordset-name", getSource().getRecordset()
757
						.getName());
758
			} catch (DriverLoadException e) {
759
				// TODO Auto-generated catch block
760
				e.printStackTrace();
747
		xml.putProperty("type", "vectorial");
748
		if (source instanceof VectorialEditableAdapter) {
749
				setSource(((VectorialEditableAdapter) source)
750
						.getOriginalAdapter());
761 751
			}
762
			// } catch (DriverException e) {
763
			// throw new XMLException(e);
764
			// }
765
		} else if (source instanceof VectorialDBAdapter) {
766
			xml.putProperty("type", "vectorial");
752
			if (source instanceof VectorialFileAdapter) {
753
				xml.putProperty("file", ((VectorialFileAdapter) source)
754
						.getFile());
755
				try {
756
					xml.putProperty("recordset-name", source
757
							.getRecordset().getName());
758
				} catch (DriverLoadException e) {
759
					e.printStackTrace();
760
				} catch (RuntimeException e) {
761
					e.printStackTrace();
762
				}
763
			} else if (source instanceof VectorialDBAdapter) {
764
				VectorialDatabaseDriver dbDriver = (VectorialDatabaseDriver) source
765
						.getDriver();
767 766

  
768
			VectorialDatabaseDriver dbDriver = (VectorialDatabaseDriver) getSource()
769
					.getDriver();
767
				// Guardamos el nombre del driver para poder recuperarlo
768
				// con el DriverManager de Fernando.
769
				xml.putProperty("db", dbDriver.getName());
770
				try {
771
					xml.putProperty("recordset-name", source
772
							.getRecordset().getName());
773
				} catch (DriverLoadException e) {
774
					e.printStackTrace();
775
				} catch (RuntimeException e) {
776
					e.printStackTrace();
777
				}
778
				if (dbDriver!=null)
779
					xml.addChild(dbDriver.getXMLEntity()); // Tercer child. Antes
780
														// hemos
781
				// metido la leyenda y el
782
				// selection support
783
			} else if (source instanceof VectorialAdapter) {
784
				VectorialDriver driver = (VectorialDriver) source.getDriver();
770 785

  
771
			// Guardamos el nombre del driver para poder recuperarlo
772
			// con el DriverManager de Fernando.
773
			xml.putProperty("db", dbDriver.getName());
774
			// try {
775
			try {
776
				xml.putProperty("recordset-name", getSource().getRecordset()
777
						.getName());
778
			} catch (DriverLoadException e) {
779
				// TODO Auto-generated catch block
780
				e.printStackTrace();
786
				// Guardamos el nombre del driver para poder recuperarlo
787
				// con el DriverManager de Fernando.
788
				xml.putProperty("other", driver.getName());
789
				try {
790
					xml.putProperty("recordset-name", source
791
							.getRecordset().getName());
792
				} catch (DriverLoadException e) {
793
					e.printStackTrace();
794
				} catch (RuntimeException e) {
795
					e.printStackTrace();
796
				}
797
				if (driver instanceof IPersistance) {
798
					// xml.putProperty("className",
799
					// driver.getClass().getName());
800
					IPersistance persist = (IPersistance) driver;
801
					xml.addChild(persist.getXMLEntity()); // Tercer child.
802
															// Antes
803
					// hemos metido la
804
					// leyenda y el
805
					// selection support
806
				}
781 807
			}
782
			// } catch (DriverException e) {
783
			// throw new XMLException(e);
784
			// }
785
			xml.addChild(dbDriver.getXMLEntity()); // Tercer child. Antes hemos
786
													// metido la leyenda y el
787
													// selection support
788
		} else if (source instanceof VectorialAdapter) {
789
			// Se supone que hemos hecho algo gen?rico.
790
			xml.putProperty("type", "vectorial");
791

  
792
			VectorialDriver driver = (VectorialDriver) getSource().getDriver();
793

  
794
			// Guardamos el nombre del driver para poder recuperarlo
795
			// con el DriverManager de Fernando.
796
			xml.putProperty("other", driver.getName());
797
			// try {
798
			try {
799
				xml.putProperty("recordset-name", getSource().getRecordset()
800
						.getName());
801
			} catch (DriverLoadException e) {
802
				// TODO Auto-generated catch block
803
				e.printStackTrace();
804
			}
805
			// } catch (DriverException e) {
806
			// throw new XMLException(e);
807
			// }
808
			if (driver instanceof IPersistance) {
809
				// xml.putProperty("className", driver.getClass().getName());
810
				IPersistance persist = (IPersistance) driver;
811
				xml.addChild(persist.getXMLEntity()); // Tercer child. Antes
812
														// hemos metido la
813
														// leyenda y el
814
														// selection support
815
			}
816
		}
817
		setSource(rv);
818
		xml.putProperty("driverName", getSource().getDriver().getName());
808
			if (rv!=null)
809
				setSource(rv);
810
			xml.putProperty("driverName", source.getDriver().getName());
811
	
819 812
		if (bHasJoin)
820 813
			xml.putProperty("hasJoin", "true");
821 814

  
......
1181 1174
				VectorialEditableAdapter vea = (VectorialEditableAdapter) getSource();
1182 1175
				//CHEMA
1183 1176
				vea.stop();
1184
				//CHEMA				
1177
				//CHEMA
1185 1178
				setSource(vea.getOriginalAdapter());
1186 1179
			}
1187 1180
			// Si tenemos una leyenda, hay que pegarle el cambiazo a su
......
1217 1210
		} catch (FieldNotFoundException e) {
1218 1211
			e.printStackTrace();
1219 1212
			throw new EditionException(e);
1220
		//CHEMA	
1213
		//CHEMA
1221 1214
		} catch (DriverIOException e) {
1222 1215
			e.printStackTrace();
1223 1216
			throw new EditionException(e);

Also available in: Unified diff