Revision 11100 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/AnnotationEditableAdapter.java

View differences:

AnnotationEditableAdapter.java
6 6
import java.awt.geom.Rectangle2D;
7 7
import java.io.IOException;
8 8
import java.util.ArrayList;
9
import java.util.Collection;
10
import java.util.Iterator;
9 11
import java.util.List;
12
import java.util.TreeMap;
10 13

  
11 14
import com.hardcode.gdbms.engine.values.DoubleValue;
12 15
import com.hardcode.gdbms.engine.values.IntValue;
16
import com.hardcode.gdbms.engine.values.NullValue;
13 17
import com.hardcode.gdbms.engine.values.NumericValue;
14 18
import com.hardcode.gdbms.engine.values.StringValue;
15 19
import com.hardcode.gdbms.engine.values.Value;
16 20
import com.hardcode.gdbms.engine.values.ValueFactory;
17 21
import com.iver.cit.gvsig.fmap.DriverException;
18 22
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
23
import com.iver.cit.gvsig.fmap.core.DefaultRow;
19 24
import com.iver.cit.gvsig.fmap.core.FShape;
20 25
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
21 26
import com.iver.cit.gvsig.fmap.core.IFeature;
......
44 49
	private boolean isInPixels=true;
45 50
	private FLyrAnnotation lyrAnnotation;
46 51
	private LabelExpansion labelExpansion=new LabelExpansion();
52
	private boolean isToSave=false;
47 53

  
48 54
	public FLabel createLabel(IRow row){
49 55
		FSymbol symbol;
......
89 95
			if (lbls[j] != null) {
90 96
				lbls[j].setString(val.toString());
91 97
				if (idFieldRotationText != -1) {
92
					DoubleValue rotation = (DoubleValue) row
93
							.getAttribute(idFieldRotationText);
94
					rotat = rotation.getValue();
98
					Value value=row.getAttribute(idFieldRotationText);
99
					if (value instanceof NullValue){
100
						rotat = sym.getRotation();
101
					}else{
102
						NumericValue rotation = (NumericValue) value;
103
						rotat = rotation.doubleValue();
104
					}
95 105
				} else {
96 106
					rotat = sym.getRotation();
97 107
				}
......
99 109

  
100 110
				float height;
101 111
				if (idFieldHeightText != -1) {
102
					NumericValue h = (NumericValue) row
103
							.getAttribute(idFieldHeightText);
104
					height = h.floatValue();
105
					lbls[j].setHeight(height);
112
					Value value=row.getAttribute(idFieldHeightText);
113
					if (value instanceof NullValue){
114
						height = sym.getFontSize();
115
						lbls[j].setHeight(height);
116
					}else{
117
						NumericValue h = (NumericValue) value;
118
						height = h.floatValue();
119
						lbls[j].setHeight(height);
120
					}
121

  
106 122
				} else {
107 123
					height = sym.getFontSize();
108 124
					lbls[j].setHeight(height);
......
463 479
            return edRow;
464 480
        }
465 481
    }
482
    public void saveEdits(IWriter writer, int sourceType)
483
			throws EditionException {
484
    	isToSave=true;
485
    	super.saveEdits(writer,sourceType);
486
    	isToSave=false;
487

  
488
	}
489

  
466 490
    private IGeometry getGeometry(Rectangle2D r){
491
    	if (isToSave)
492
    		return ShapeFactory.createPoint2D(r.getX(),r.getMaxY());
467 493
    	GeneralPathX resul = new GeneralPathX();
468 494
		Point2D[] vs=new Point2D[4];
469 495
		vs[0]=new Point2D.Double(r.getX(),r.getY());

Also available in: Unified diff