Revision 10926 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java

View differences:

FLyrVect.java
101 101
import com.iver.cit.gvsig.fmap.rendering.LegendFactory;
102 102
import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend;
103 103
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend;
104
import com.iver.cit.gvsig.fmap.rendering.styling.AttrInTableLabeling;
104 105
import com.iver.cit.gvsig.fmap.rendering.styling.ILabelingStrategy;
105 106
import com.iver.cit.gvsig.fmap.rendering.styling.LabelingFactory;
106 107
import com.iver.cit.gvsig.fmap.spatialindex.IPersistentSpatialIndex;
......
630 631
		}
631 632
	}
632 633

  
633
	/**
634
	/*
634 635
	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setXMLEntity(com.iver.utiles.XMLEntity)
635 636
	 */
636 637
	public void setXMLEntity(XMLEntity xml) throws XMLException {
637 638
		try {
638 639
			super.setXMLEntity(xml);
639

  
640
			VectorialLegend leg = LegendFactory.createFromXML(xml.getChild(0));
640
			XMLEntity legendXML = xml.getChild(0);
641
			VectorialLegend leg = LegendFactory.createFromXML(legendXML);
642
			/* (jaume) begin patch;
643
	    	 * for backward compatibility purposes. Since gvSIG v1.1 labeling is
644
	    	 * no longer managed by the Legend but by the ILabelingStrategy. The
645
	    	 * following allows restoring older projects' labelings.
646
	    	 */
647
			if (legendXML.contains("labelFieldName")) {
648
	    		AttrInTableLabeling labeling = new AttrInTableLabeling();
649
	    		labeling.setLayer(this);
650
	    		labeling.setTextField(legendXML.getStringProperty("labelFieldName"));
651
	    		labeling.setHeightField(legendXML.getStringProperty("labelHeightFieldName"));
652
	    		labeling.setRotationField(legendXML.getStringProperty("labelRotationFieldName"));
653
	    		this.setLabelingStrategy(labeling);
654
	    		this.setIsLabeled(true);
655
	      	}
656
	    	/* end patch */
641 657
			try {
642 658
				getRecordset().getSelectionSupport().setXMLEntity(xml.getChild(1));
643 659
				// JMVIVO: Esto sirve para algo????
......
695 711
		try {
696 712
			super.setXMLEntity(xml);
697 713

  
698
			VectorialLegend leg = LegendFactory.createFromXML(xml.getChild(0));
714
			XMLEntity legendXML = xml.getChild(0);
715
			VectorialLegend leg = LegendFactory.createFromXML(legendXML);
716
			/* (jaume) begin patch;
717
	    	 * for backward compatibility purposes. Since gvSIG v1.1 labeling is
718
	    	 * no longer managed by the Legend but by the ILabelingStrategy. The
719
	    	 * following allows restoring older projects' labelings.
720
	    	 */
721
	    	if (legendXML.contains("labelFieldHeight")) {
722
	    		AttrInTableLabeling labeling = new AttrInTableLabeling();
723
	    		labeling.setLayer(this);
724
	    		labeling.setTextField(legendXML.getStringProperty("labelFieldHeight"));
725
	    		labeling.setRotationField(legendXML.getStringProperty("labelFieldRotation"));
726
	    		this.setLabelingStrategy(labeling);
727
	    		this.setIsLabeled(true);
728
	      	}
729
	    	/* end patch */
699 730
			try {
700 731
				getRecordset().getSelectionSupport().setXMLEntity(xml.getChild(1));
701 732

  

Also available in: Unified diff