Revision 4619

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/AnnotationEditableAdapter.java
4 4
import java.awt.geom.Rectangle2D;
5 5
import java.io.IOException;
6 6
import java.util.ArrayList;
7
import java.util.BitSet;
7 8
import java.util.List;
8 9

  
9 10
import com.hardcode.gdbms.engine.values.NumericValue;
......
28 29
public class AnnotationEditableAdapter extends VectorialEditableAdapter{
29 30
	private ArrayList labels;
30 31
	private MappingAnnotation mapping;
32
	private BitSet delBitset=new BitSet();
31 33

  
32 34
	public int doAddRow(IRow feat) throws DriverIOException, IOException {
33 35
		return super.doAddRow(feat);
......
126 128
	}
127 129

  
128 130
	public IRow doRemoveRow(int index) throws DriverIOException, IOException {
131
		delBitset.set(index);
129 132
		return super.doRemoveRow(index);
130 133
	}
131 134

  
......
143 146
	}
144 147

  
145 148
	public void undoRemoveRow(int index) throws IOException, DriverIOException {
149
		delBitset.set(index,false);
146 150
		super.undoRemoveRow(index);
147 151
	}
148 152

  
149
	public AnnotationEditableAdapter(ArrayList labels,MappingAnnotation mapping) {
153
	public AnnotationEditableAdapter(FLyrAnnotation lyrAnnotation) {
150 154
		super();
151
		this.labels=labels;
152
		this.mapping=mapping;
155
		this.labels=lyrAnnotation.getLabels();
156
		this.mapping=lyrAnnotation.getMapping();
157
		this.delBitset=lyrAnnotation.getDelBitSet();
153 158
	}
154 159
	public IRowEdited[] getFeatures(Rectangle2D r, String strEPSG) throws DriverException {
155 160
		// En esta clase suponemos random access.
......
184 189
			try {
185 190
				IFeature f=ova.getFeature(calculatedIndex);
186 191
				//IGeometry g=f.getGeometry().cloneGeometry();
187
				IGeometry geom=getGeometry(((FLabel)labels.get(index)).getBoundBox());
192
				IGeometry geom=getGeometry(((FLabel)labels.get(calculatedIndex)).getBoundBox());
188 193
				f=new DefaultFeature(geom,f.getAttributes());
189 194
				edRow = new DefaultRowEdited(f,
190
				        DefaultRowEdited.STATUS_ORIGINAL, index);
195
				        DefaultRowEdited.STATUS_ORIGINAL, calculatedIndex);
191 196
				System.out.println("Piden la feature con ID= " + index);
192 197
				// Exception e = new Exception();
193 198
				// e.printStackTrace();
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/MapControl.java
62 62
import org.cresques.cts.IProjection;
63 63
import org.cresques.cts.ProjectionPool;
64 64

  
65
import com.iver.cit.gvsig.fmap.edition.commands.CommandEvent;
66 65
import com.iver.cit.gvsig.fmap.edition.commands.CommandListener;
67 66
import com.iver.cit.gvsig.fmap.layers.LayerEvent;
68 67
import com.iver.cit.gvsig.fmap.operations.Cancellable;
......
104 103
	private MapToolListener mapToolListener = new MapToolListener();
105 104
	private MapContextListener mapContextListener = new MapContextListener();
106 105
	private ExceptionHandlingSupport exceptionHandlingSupport = new ExceptionHandlingSupport();
107
	private HashMap namesCadTools = new HashMap();
106

  
108 107
	/**
109 108
     * We need this to avoid not wanted refresh. REMEMBER TO SET TO TRUE!!
110 109
     */
......
876 875
	public HashMap getNamesMapTools() {
877 876
		return namesMapTools;
878 877
	}
879
/*	public void addCadTool(String name, CADTool c){
880
		namesCadTools.put(name, c);
881
	}
882
	public void setCadTool(String text){
883
		CADTool ct = (CADTool) namesCadTools.get(text);
884
		if (ct == null) throw new RuntimeException("No such cad tool");
885
		ct.init();
886
		cadToolAdapter.setCadTool(ct);
887
		setTool("cadEdition");
888
		//clearMouseImage();
889
	}
890
*/
891 878

  
892 879
	public void commandRepaint() {
893 880
		drawMap(false);
trunk/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;
43 44
import java.awt.Graphics2D;
44 45
import java.awt.geom.Point2D;
45 46
import java.awt.geom.Rectangle2D;
......
56 57
import com.iver.cit.gvsig.fmap.DriverException;
57 58
import com.iver.cit.gvsig.fmap.ViewPort;
58 59
import com.iver.cit.gvsig.fmap.MapControl.CancelDraw;
60
import com.iver.cit.gvsig.fmap.core.Handler;
59 61
import com.iver.cit.gvsig.fmap.core.IGeometry;
62
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
63
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
60 64
import com.iver.cit.gvsig.fmap.drivers.BoundedShapes;
61 65
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
62 66
import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver;
......
233 237
					throw e;
234 238
				}
235 239
            }
236

  
237 240
    		if (getVirtualLayers() != null) {
238 241
    			getVirtualLayers().draw(image, g, viewPort, cancel,scale);
239 242
    		}
......
813 816
				vea = new VectorialEditableDBAdapter();
814 817
			}else if (this instanceof FLyrAnnotation)
815 818
			{
816
				vea = new AnnotationEditableAdapter(((FLyrAnnotation)this).getLabels(),((FLyrAnnotation)this).getMapping());
819
				vea = new AnnotationEditableAdapter((FLyrAnnotation)this);
817 820
			}
818 821
			else
819 822
			{
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrAnnotation.java
9 9
import java.io.File;
10 10
import java.io.IOException;
11 11
import java.util.ArrayList;
12
import java.util.BitSet;
12 13

  
13 14
import org.cresques.cts.ICoordTrans;
14 15
import org.cresques.cts.IProjection;
......
55 56
	private MappingAnnotation mapping = null;
56 57

  
57 58
	private ArrayList m_labels;
58

  
59
	private BitSet delBitSet=new BitSet();
59 60
	private boolean isCreateSpatialIndex = false;
60 61

  
61 62
	private int indexEditing = -1;
......
561 562
		}
562 563

  
563 564
	}
565

  
566
	public BitSet getDelBitSet() {
567
		return delBitSet;
568
	}
569

  
570
	public void setDelBitSet(BitSet delBitSet) {
571
		this.delBitSet = delBitSet;
572
	}
564 573
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/AnnotationStrategy.java
89 89
				if (cancel.isCanceled()) {
90 90
					break;
91 91
				}
92
				if (((FLyrAnnotation) capa).getDelBitSet().get(numReg))continue;
92 93
				FLabel theLabel = (FLabel) ((FLyrAnnotation) capa).getLabel(numReg);
93 94
				if ((theLabel == null) || (theLabel.getOrig() == null))
94 95
					continue;

Also available in: Unified diff