Revision 12148
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableDBAdapter.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
public class VectorialEditableDBAdapter extends VectorialEditableAdapter |
42 | 42 |
implements ISpatialDB { |
43 |
private int maxIndex=0; |
|
44 | 43 |
private class MyIterator implements IFeatureIterator { |
45 | 44 |
private Rectangle2D extent = null; |
46 | 45 |
|
... | ... | |
253 | 252 |
|
254 | 253 |
|
255 | 254 |
private Hashtable mapFID2index = new Hashtable(); |
256 |
private Hashtable mapIndex2FID = new Hashtable(); |
|
255 |
// private Hashtable mapIndex2FID = new Hashtable();
|
|
257 | 256 |
/** |
258 | 257 |
* |
259 | 258 |
*/ |
... | ... | |
313 | 312 |
IFeature feat = ova.getFeature(i); |
314 | 313 |
Integer calculatedIndex = new Integer(i); |
315 | 314 |
mapFID2index.put(feat.getID(), calculatedIndex); |
316 |
int featInt=Integer.parseInt(feat.getID()); |
|
317 |
if (maxIndex<featInt){ |
|
318 |
maxIndex=featInt; |
|
319 |
} |
|
320 |
mapIndex2FID.put(calculatedIndex, feat.getID()); |
|
315 |
// mapIndex2FID.put(calculatedIndex, feat.getID()); |
|
321 | 316 |
} |
322 | 317 |
|
323 | 318 |
/* |
... | ... | |
404 | 399 |
// es decir, virtual es el calculatedIndex (no tiene en cuenta los borrados) |
405 | 400 |
// calculatedIndex = indiceExterno + borrados hasta ese punto. |
406 | 401 |
mapFID2index.put(feat.getID(), virtual); |
407 |
mapIndex2FID.put(virtual, feat.getID()); |
|
402 |
// mapIndex2FID.put(virtual, feat.getID());
|
|
408 | 403 |
return calculatedIndex; |
409 | 404 |
|
410 | 405 |
} |
... | ... | |
417 | 412 |
// No hacemos nada con las modificaciones sobre los ?ndices. |
418 | 413 |
// Suponiendo que feat tenga la misma ID que la que hab?a antes. |
419 | 414 |
Integer virtual = new Integer(calculatedIndex); |
420 |
String theIDoriginal = (String) mapIndex2FID.get(virtual); |
|
421 |
if (!theIDoriginal.equals(feat.getID())) |
|
422 |
{ |
|
423 |
AssertionError err = new AssertionError("Fallo al modificar la fila. ID viejo=" + theIDoriginal + " ID nuevo = " + feat.getID()); |
|
424 |
err.printStackTrace(); |
|
425 |
} |
|
415 |
// String theIDoriginal = (String) mapIndex2FID.get(virtual);
|
|
416 |
// if (!theIDoriginal.equals(feat.getID()))
|
|
417 |
// {
|
|
418 |
// AssertionError err = new AssertionError("Fallo al modificar la fila. ID viejo=" + theIDoriginal + " ID nuevo = " + feat.getID());
|
|
419 |
// err.printStackTrace();
|
|
420 |
// }
|
|
426 | 421 |
// hashFIDtoExpansionFile.put(feat.getID(), new Integer(posInExpansionFile)); |
427 | 422 |
mapFID2index.put(feat.getID(), virtual); |
428 |
mapIndex2FID.put(virtual, feat.getID()); |
|
423 |
// mapIndex2FID.put(virtual, feat.getID());
|
|
429 | 424 |
return posAnteriorInExpansionFile; |
430 | 425 |
} |
431 | 426 |
|
... | ... | |
448 | 443 |
// TODO Auto-generated method stub |
449 | 444 |
super.undoAddRow(calculatedIndex,sourceType); |
450 | 445 |
Integer calculated = new Integer(calculatedIndex); |
451 |
String theID = (String) mapIndex2FID.get(calculated); |
|
446 |
// String theID = (String) mapIndex2FID.get(calculated);
|
|
452 | 447 |
mapFID2index.remove(calculated); |
453 |
mapIndex2FID.remove(theID); |
|
448 |
// mapIndex2FID.remove(theID);
|
|
454 | 449 |
|
455 | 450 |
} |
456 | 451 |
public void cancelEdition(int sourceType) throws CancelEditingLayerException { |
457 | 452 |
super.cancelEdition(sourceType); |
458 | 453 |
mapFID2index.clear(); |
459 |
mapIndex2FID.clear(); |
|
454 |
// mapIndex2FID.clear();
|
|
460 | 455 |
} |
461 | 456 |
|
462 | 457 |
public void stopEdition(IWriter writer, int sourceType) throws StopWriterVisitorException{ |
463 | 458 |
super.stopEdition(writer, sourceType); |
464 | 459 |
mapFID2index.clear(); |
465 |
mapIndex2FID.clear(); |
|
460 |
// mapIndex2FID.clear();
|
|
466 | 461 |
} |
467 |
public int getNewIndex(){ |
|
468 |
int index = maxIndex+1; |
|
469 |
while(mapFID2index.containsKey(String.valueOf(index))){ |
|
470 |
index++; |
|
471 |
} |
|
472 |
return index; |
|
473 |
} |
|
474 |
|
|
475 | 462 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/EditableAdapter.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.fmap.edition; |
2 | 2 |
|
3 | 3 |
import java.io.IOException; |
4 |
import java.rmi.server.UID; |
|
4 | 5 |
import java.util.ArrayList; |
5 | 6 |
import java.util.Collection; |
6 | 7 |
import java.util.HashMap; |
... | ... | |
647 | 648 |
} catch (ReadDriverException e) { |
648 | 649 |
throw new EditionCommandException(writer.getName(),e); |
649 | 650 |
} |
650 |
boolean cancel = fireBeforeModifyRow(edRow, geometryIndex, |
|
651 |
sourceType); |
|
651 |
boolean cancel=true; |
|
652 |
try { |
|
653 |
cancel = fireBeforeModifyRow(edRow, geometryIndex, |
|
654 |
sourceType); |
|
655 |
} catch (ReadDriverException e) { |
|
656 |
throw new EditionCommandException(writer.getName(),e); |
|
657 |
} |
|
652 | 658 |
if (cancel) |
653 | 659 |
return; |
654 | 660 |
// Se elimina de las relaciones y del fichero de expansi?n |
655 | 661 |
relations.remove(new Integer(geometryIndex)); |
656 | 662 |
expansionFile.deleteLastRow(); |
657 | 663 |
} else { |
658 |
boolean cancel; |
|
664 |
boolean cancel=true;
|
|
659 | 665 |
try { |
660 | 666 |
cancel = fireBeforeModifyRow(expansionFile |
661 | 667 |
.getRow(previousExpansionFileIndex), geometryIndex, |
662 | 668 |
sourceType); |
663 | 669 |
} catch (ExpansionFileReadException e) { |
664 | 670 |
throw new EditionCommandException(writer.getName(),e); |
671 |
} catch (ReadDriverException e) { |
|
672 |
throw new EditionCommandException(writer.getName(),e); |
|
665 | 673 |
} |
666 | 674 |
if (cancel) |
667 | 675 |
return; |
... | ... | |
769 | 777 |
* @throws IOException |
770 | 778 |
*/ |
771 | 779 |
public int doAddRow(IRow feat, int sourceType) throws ReadDriverException, ExpansionFileWriteException { |
772 |
boolean cancel = fireBeforeRowAdded(sourceType); |
|
780 |
boolean cancel = fireBeforeRowAdded(sourceType,feat.getID());
|
|
773 | 781 |
if (cancel) |
774 | 782 |
return -1; |
775 | 783 |
// A?ade la geometr?a |
... | ... | |
795 | 803 |
* DOCUMENT ME! |
796 | 804 |
*/ |
797 | 805 |
public void undoRemoveRow(int index, int sourceType) throws EditionCommandException { |
798 |
boolean cancel; |
|
806 |
delRows.set(index, false); |
|
807 |
String fid; |
|
799 | 808 |
try { |
800 |
cancel = fireBeforeRowAdded(sourceType); |
|
809 |
fid = getRow(index).getID(); |
|
810 |
|
|
811 |
boolean cancel = fireBeforeRowAdded(sourceType,fid); |
|
812 |
if (cancel){ |
|
813 |
delRows.set(index,true); |
|
814 |
return; |
|
815 |
} |
|
816 |
} catch (ExpansionFileReadException e) { |
|
817 |
throw new EditionCommandException(getOriginalDriver().getName(),e); |
|
801 | 818 |
} catch (ReadDriverException e) { |
802 |
throw new EditionCommandException(writer.getName(),e);
|
|
819 |
throw new EditionCommandException(getOriginalDriver().getName(),e);
|
|
803 | 820 |
} |
804 |
if (cancel) |
|
805 |
return; |
|
806 |
delRows.set(index, false); |
|
807 | 821 |
fireAfterRowAdded(null,index, sourceType); |
808 | 822 |
} |
809 | 823 |
|
... | ... | |
819 | 833 |
*/ |
820 | 834 |
public void undoAddRow(int calculatedIndex, int sourceType) |
821 | 835 |
throws EditionCommandException { |
822 |
boolean cancel = fireBeforeRemoveRow(calculatedIndex, sourceType); |
|
836 |
boolean cancel; |
|
837 |
try { |
|
838 |
cancel = fireBeforeRemoveRow(calculatedIndex, sourceType); |
|
839 |
} catch (ReadDriverException e) { |
|
840 |
throw new EditionCommandException(getOriginalDriver().getName(),e); |
|
841 |
} |
|
823 | 842 |
if (cancel) |
824 | 843 |
return; |
825 | 844 |
expansionFile.deleteLastRow(); |
... | ... | |
1160 | 1179 |
|
1161 | 1180 |
} |
1162 | 1181 |
|
1163 |
protected boolean fireBeforeRemoveRow(int index, int sourceType) { |
|
1182 |
protected boolean fireBeforeRemoveRow(int index, int sourceType) throws ReadDriverException {
|
|
1164 | 1183 |
Cancel cancel = new Cancel(); |
1165 |
BeforeRowEditEvent event = new BeforeRowEditEvent(this, index, |
|
1184 |
String fid=null; |
|
1185 |
try { |
|
1186 |
fid = getRow(index).getID(); |
|
1187 |
} catch (ExpansionFileReadException e) { |
|
1188 |
throw new ReadDriverException(getOriginalDriver().getName(),e); |
|
1189 |
} |
|
1190 |
BeforeRowEditEvent event = new BeforeRowEditEvent(this, fid, |
|
1166 | 1191 |
EditionEvent.CHANGE_TYPE_DELETE, cancel, sourceType); |
1167 | 1192 |
for (int i = 0; i < editionListeners.size(); i++) { |
1168 | 1193 |
IEditionListener listener = (IEditionListener) editionListeners |
... | ... | |
1232 | 1257 |
} |
1233 | 1258 |
|
1234 | 1259 |
|
1235 |
protected boolean fireBeforeRowAdded(int sourceType) throws ReadDriverException{ |
|
1260 |
protected boolean fireBeforeRowAdded(int sourceType,String newFID) throws ReadDriverException{
|
|
1236 | 1261 |
Cancel cancel = new Cancel(); |
1237 |
BeforeRowEditEvent event = new BeforeRowEditEvent(this, getNewIndex(),
|
|
1262 |
BeforeRowEditEvent event = new BeforeRowEditEvent(this, newFID,
|
|
1238 | 1263 |
EditionEvent.CHANGE_TYPE_ADD, cancel, sourceType); |
1239 | 1264 |
for (int i = 0; i < editionListeners.size(); i++) { |
1240 | 1265 |
IEditionListener listener = (IEditionListener) editionListeners |
... | ... | |
1275 | 1300 |
} |
1276 | 1301 |
|
1277 | 1302 |
|
1278 |
protected boolean fireBeforeModifyRow(IRow feat, int index, int sourceType) { |
|
1303 |
protected boolean fireBeforeModifyRow(IRow feat, int index, int sourceType) throws ReadDriverException {
|
|
1279 | 1304 |
Cancel cancel = new Cancel(); |
1280 |
BeforeRowEditEvent event = new BeforeRowEditEvent(this, index, |
|
1305 |
String fid=null; |
|
1306 |
try { |
|
1307 |
fid = getRow(index).getID(); |
|
1308 |
} catch (ExpansionFileReadException e) { |
|
1309 |
throw new ReadDriverException(getOriginalDriver().getName(),e); |
|
1310 |
} |
|
1311 |
BeforeRowEditEvent event = new BeforeRowEditEvent(this, fid, |
|
1281 | 1312 |
EditionEvent.CHANGE_TYPE_MODIFY, cancel, sourceType); |
1282 | 1313 |
for (int i = 0; i < editionListeners.size(); i++) { |
1283 | 1314 |
IEditionListener listener = (IEditionListener) editionListeners |
... | ... | |
1626 | 1657 |
public FieldDescription[] getFieldsDescription() { |
1627 | 1658 |
return (FieldDescription[]) fastAccessFields.toArray(new FieldDescription[0]); |
1628 | 1659 |
} |
1629 |
public int getNewIndex() throws ReadDriverException { |
|
1630 |
int index=(int)ods.getRowCount() + numAdd; |
|
1631 |
return index; |
|
1660 |
public String getNewFID() { |
|
1661 |
return "fid-" + (new UID()).toString(); |
|
1632 | 1662 |
} |
1633 | 1663 |
|
1634 | 1664 |
// private InternalField getInternalFieldByIndex(int fieldId) |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/BeforeRowEditEvent.java | ||
---|---|---|
4 | 4 |
|
5 | 5 |
public class BeforeRowEditEvent extends EditionEvent { |
6 | 6 |
|
7 |
long numRow;
|
|
7 |
String newFID;
|
|
8 | 8 |
int changeType; |
9 | 9 |
Cancellable cancel; |
10 |
public BeforeRowEditEvent(IEditableSource source, long numRow, int changeType, Cancellable cancel,int sourceType)
|
|
10 |
public BeforeRowEditEvent(IEditableSource source, String newFID, int changeType, Cancellable cancel,int sourceType)
|
|
11 | 11 |
{ |
12 | 12 |
super(source, EditionEvent.ROW_EDITION, sourceType); |
13 |
this.numRow = numRow;
|
|
13 |
this.newFID = newFID;
|
|
14 | 14 |
this.changeType = changeType; |
15 | 15 |
this.cancel = cancel; |
16 | 16 |
} |
... | ... | |
29 | 29 |
/** |
30 | 30 |
* @return Returns the numRow. |
31 | 31 |
*/ |
32 |
public long getNumRow() {
|
|
33 |
return numRow;
|
|
32 |
public String getFID() {
|
|
33 |
return newFID;
|
|
34 | 34 |
} |
35 | 35 |
|
36 | 36 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/AnnotationEditableAdapter.java | ||
---|---|---|
167 | 167 |
|
168 | 168 |
|
169 | 169 |
public int doAddRow(IRow feat, int sourceType) throws ReadDriverException, ExpansionFileWriteException { |
170 |
boolean cancel = fireBeforeRowAdded(sourceType); |
|
170 |
boolean cancel = fireBeforeRowAdded(sourceType,feat.getID());
|
|
171 | 171 |
if (cancel) |
172 | 172 |
return -1; |
173 | 173 |
Value[] values=feat.getAttributes(); |
... | ... | |
185 | 185 |
///lyrAnnotation.deleteSpatialIndex(); |
186 | 186 |
|
187 | 187 |
int calculatedIndex = -1; |
188 |
calculatedIndex = getNewIndex() ;
|
|
188 |
calculatedIndex = (int) getOriginalRecordset().getRowCount() + numAdd;
|
|
189 | 189 |
|
190 | 190 |
int pos = expansionFile.addRow(feat, IRowEdited.STATUS_ADDED, actualIndexFields); |
191 | 191 |
labelExpansion.addLabel(label); |
... | ... | |
200 | 200 |
} |
201 | 201 |
|
202 | 202 |
public int doModifyRow(int calculatedIndex, IRow feat,int sourceType) throws ExpansionFileWriteException { |
203 |
boolean cancel = fireBeforeModifyRow(feat,calculatedIndex, sourceType); |
|
203 |
boolean cancel; |
|
204 |
try { |
|
205 |
cancel = fireBeforeModifyRow(feat,calculatedIndex, sourceType); |
|
206 |
} catch (ReadDriverException e) { |
|
207 |
throw new ExpansionFileWriteException(writer.getName(),e); |
|
208 |
} |
|
204 | 209 |
if (cancel) |
205 | 210 |
return -1; |
206 | 211 |
int posAnteriorInExpansionFile = -1; |
... | ... | |
317 | 322 |
} |
318 | 323 |
|
319 | 324 |
public void undoAddRow(int calculatedIndex, int sourceType) throws EditionCommandException { |
320 |
boolean cancel = fireBeforeRemoveRow(calculatedIndex, sourceType); |
|
325 |
boolean cancel=true; |
|
326 |
try { |
|
327 |
cancel = fireBeforeRemoveRow(calculatedIndex, sourceType); |
|
328 |
} catch (ReadDriverException e1) { |
|
329 |
throw new EditionCommandException(writer.getName(),e1); |
|
330 |
} |
|
321 | 331 |
if (cancel) |
322 | 332 |
return; |
323 | 333 |
Rectangle2D r = getLabel(calculatedIndex,true).getBoundBox(); |
... | ... | |
405 | 415 |
} |
406 | 416 |
|
407 | 417 |
public void undoRemoveRow(int index, int sourceType) throws EditionCommandException { |
408 |
boolean cancel; |
|
418 |
delRows.set(index, false); |
|
419 |
String fid; |
|
409 | 420 |
try { |
410 |
cancel = fireBeforeRowAdded(sourceType); |
|
421 |
fid = getRow(index).getID(); |
|
422 |
|
|
423 |
boolean cancel = fireBeforeRowAdded(sourceType,fid); |
|
424 |
if (cancel){ |
|
425 |
delRows.set(index,true); |
|
426 |
return; |
|
427 |
} |
|
428 |
} catch (ExpansionFileReadException e) { |
|
429 |
throw new EditionCommandException(lyrAnnotation.getName(),e); |
|
411 | 430 |
} catch (ReadDriverException e) { |
412 |
throw new EditionCommandException(writer.getName(),e);
|
|
431 |
throw new EditionCommandException(lyrAnnotation.getName(),e);
|
|
413 | 432 |
} |
414 |
if (cancel) |
|
415 |
return; |
|
416 |
delRows.set(index, false); |
|
417 | 433 |
Rectangle2D r = getLabel(index,true).getBoundBox(); |
418 | 434 |
this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(), |
419 | 435 |
r.getY(), r.getY() + r.getHeight()), new Integer(index)); |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/EditVertexCADTool.java | ||
---|---|---|
55 | 55 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException; |
56 | 56 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileWriteException; |
57 | 57 |
import com.iver.cit.gvsig.exceptions.validate.ValidateRowException; |
58 |
import com.iver.cit.gvsig.fmap.ViewPort; |
|
58 | 59 |
import com.iver.cit.gvsig.fmap.core.DefaultFeature; |
59 | 60 |
import com.iver.cit.gvsig.fmap.core.FGeometryCollection; |
60 | 61 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
... | ... | |
177 | 178 |
* @param y par?metro x del punto que se pase para dibujar. |
178 | 179 |
*/ |
179 | 180 |
public void drawOperation(Graphics g, double x, double y) { |
180 |
//EditVertexCADToolState actualState = ((EditVertexCADToolContext) _fsm).getState(); |
|
181 |
//String status = actualState.getName(); |
|
182 |
//VectorialEditableAdapter vea = getCadToolAdapter().getVectorialAdapter(); |
|
183 |
//FBitSet selection = vea.getSelection(); |
|
184 |
|
|
185 |
try { |
|
186 |
drawVertex(g,getCadToolAdapter().getMapControl().getViewPort() |
|
187 |
.getAffineTransform()); |
|
188 |
} catch (DriverIOException e) { |
|
189 |
e.printStackTrace(); |
|
190 |
} |
|
191 |
|
|
181 |
drawVertex(g,getCadToolAdapter().getMapControl().getViewPort()); |
|
192 | 182 |
} |
193 | 183 |
|
194 | 184 |
/** |
... | ... | |
272 | 262 |
} |
273 | 263 |
} |
274 | 264 |
} |
275 |
private void drawVertex(Graphics g,AffineTransform at) throws DriverIOException{
|
|
265 |
private void drawVertex(Graphics g,ViewPort vp){
|
|
276 | 266 |
ArrayList selectedRows=getSelectedRows(); |
277 | 267 |
for (int i = 0; i<selectedRows.size(); |
278 | 268 |
i++) { |
... | ... | |
280 | 270 |
.get(i)).getLinkedRow(); |
281 | 271 |
IGeometry ig = fea.getGeometry().cloneGeometry(); |
282 | 272 |
if (ig == null) continue; |
283 |
Handler[] handlers=ig.getHandlers(IGeometry.SELECTHANDLER); |
|
284 |
if (numSelect>=handlers.length) |
|
285 |
numSelect=0; |
|
286 |
FGraphicUtilities.DrawVertex((Graphics2D)g,at,handlers[numSelect]); |
|
273 |
ig.drawInts((Graphics2D)g,vp,DefaultCADTool.geometrySelectSymbol); |
|
274 |
Handler[] handlers=ig.getHandlers(IGeometry.SELECTHANDLER); |
|
275 |
if (numSelect>=handlers.length) |
|
276 |
numSelect=0; |
|
277 |
FGraphicUtilities.DrawVertex((Graphics2D)g,vp.getAffineTransform(),handlers[numSelect]); |
|
287 | 278 |
} |
288 | 279 |
} |
289 | 280 |
|
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/InternalPolygonCADTool.java | ||
---|---|---|
171 | 171 |
gpx.lineTo(x,y); |
172 | 172 |
gpx.closePath(); |
173 | 173 |
gpx1.closePath(); |
174 |
if (ps.length==1){ |
|
175 |
IGeometry geom=ShapeFactory.createPolyline2D(gpx); |
|
176 |
geom.drawInts((Graphics2D)g,CADExtension.getEditionManager().getMapControl().getViewPort(),DefaultCADTool.geometrySelectSymbol); |
|
177 |
} |
|
174 | 178 |
IGeometry geom=ShapeFactory.createPolygon2D(gpx); |
175 | 179 |
IGeometry geom1=ShapeFactory.createPolygon2D(gpx1); |
176 |
geom1.draw((Graphics2D)g,CADExtension.getEditionManager().getMapControl().getViewPort(),DefaultCADTool.selectionSymbol); |
|
177 |
geom.draw((Graphics2D)g,CADExtension.getEditionManager().getMapControl().getViewPort(),DefaultCADTool.geometrySelectSymbol); |
|
180 |
geom1.drawInts((Graphics2D)g,CADExtension.getEditionManager().getMapControl().getViewPort(),DefaultCADTool.selectionSymbol);
|
|
181 |
geom.drawInts((Graphics2D)g,CADExtension.getEditionManager().getMapControl().getViewPort(),DefaultCADTool.geometrySelectSymbol);
|
|
178 | 182 |
} |
183 |
DefaultRowEdited[] rows=(DefaultRowEdited[])getSelectedRows().toArray(new DefaultRowEdited[0]); |
|
184 |
for (int i=0;i<rows.length;i++){ |
|
185 |
((IFeature)rows[i].getLinkedRow()).getGeometry().drawInts((Graphics2D)g,CADExtension.getEditionManager().getMapControl().getViewPort(),DefaultCADTool.selectionSymbol); |
|
186 |
} |
|
179 | 187 |
} |
180 | 188 |
|
181 | 189 |
/** |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/ExploitCADTool.java | ||
---|---|---|
191 | 191 |
selectedRowAux.add(new DefaultRowEdited(dfAux, |
192 | 192 |
IRowEdited.STATUS_ADDED, index)); |
193 | 193 |
} |
194 |
getCadToolAdapter().getMapControl().drawMap(false); |
|
194 | 195 |
} |
195 | 196 |
private void exploitLine(DefaultRowEdited dre,ArrayList selectedRowAux){ |
196 | 197 |
GeneralPathX newGp1 = new GeneralPathX(); |
... | ... | |
286 | 287 |
|
287 | 288 |
theIterator.next(); |
288 | 289 |
} // end while loop |
289 |
|
|
290 |
getCadToolAdapter().getMapControl().drawMap(false); |
|
290 | 291 |
} |
291 | 292 |
private void exploitPolygon(DefaultRowEdited dre,ArrayList selectedRowAux) { |
292 | 293 |
GeneralPathX newGp1 = null; |
... | ... | |
355 | 356 |
selectedRowAux.add(new DefaultRowEdited(dfLine, |
356 | 357 |
IRowEdited.STATUS_ADDED, indexLine)); |
357 | 358 |
} |
358 |
|
|
359 |
getCadToolAdapter().getMapControl().drawMap(false); |
|
359 | 360 |
} |
360 | 361 |
/** |
361 | 362 |
* Add a diferent option. |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/SymmetryCADTool.java | ||
---|---|---|
252 | 252 |
int index=addGeometry(geom,fea.getAttributes()); |
253 | 253 |
selectedRowAux.add(new DefaultRowEdited(fea, |
254 | 254 |
IRowEdited.STATUS_ADDED, index)); |
255 |
getCadToolAdapter().getMapControl().drawMap(false); |
|
255 | 256 |
} |
256 | 257 |
|
257 | 258 |
} |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/RotateCADTool.java | ||
---|---|---|
258 | 258 |
if (!vle.getLayer().isVisible()) |
259 | 259 |
return; |
260 | 260 |
Image imgSel = vle.getSelectionImage(); |
261 |
g.drawImage(imgSel, 0, 0, null); |
|
261 |
if (imgSel!=null) |
|
262 |
g.drawImage(imgSel, 0, 0, null); |
|
262 | 263 |
Image imgHand = vle.getHandlersImage(); |
263 |
g.drawImage(imgHand, 0, 0, null); |
|
264 |
if (imgHand!=null) |
|
265 |
g.drawImage(imgHand, 0, 0, null); |
|
264 | 266 |
} |
265 | 267 |
} |
266 | 268 |
|
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/JoinCADTool.java | ||
---|---|---|
266 | 266 |
VectorialEditableAdapter vea = vle.getVEA(); |
267 | 267 |
vea.startComplexRow(); |
268 | 268 |
|
269 |
int num = vea.getRowCount();
|
|
269 |
String newFID = vea.getNewFID();
|
|
270 | 270 |
GeneralPathX gpx = new GeneralPathX(); |
271 | 271 |
gpx.moveTo(points[0].getX(), points[0].getY()); |
272 | 272 |
gpx.lineTo(points[1].getX(), points[1].getY()); |
273 | 273 |
|
274 | 274 |
IGeometry geom = ShapeFactory.createPolyline2D(gpx); |
275 |
DefaultFeature df1 = new DefaultFeature(geom, null, String.valueOf(num));
|
|
275 |
DefaultFeature df1 = new DefaultFeature(geom, null, newFID);
|
|
276 | 276 |
|
277 | 277 |
for (int i = rows.length - 1; i >= 0; i--) { |
278 | 278 |
vea.removeRow(rows[i].getIndex(), getName(), EditionEvent.GRAPHIC); |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/DefaultCADTool.java | ||
---|---|---|
55 | 55 |
import com.hardcode.gdbms.engine.values.Value; |
56 | 56 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
57 | 57 |
import com.iver.andami.PluginServices; |
58 |
import com.iver.andami.messages.NotificationManager; |
|
58 | 59 |
import com.iver.cit.gvsig.CADExtension; |
59 | 60 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException; |
60 | 61 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileWriteException; |
... | ... | |
184 | 185 |
for (int i = 0; i < numAttr; i++) { |
185 | 186 |
values[i] = ValueFactory.createNullValue(); |
186 | 187 |
} |
187 |
int num; |
|
188 |
num = vea.getRowCount(); |
|
189 |
DefaultFeature df = new DefaultFeature(geometry, values, String |
|
190 |
.valueOf(num)); |
|
188 |
String newFID = vea.getNewFID(); |
|
189 |
DefaultFeature df = new DefaultFeature(geometry, values, newFID); |
|
191 | 190 |
int index = vea.addRow(df, getName(), EditionEvent.GRAPHIC); |
192 | 191 |
VectorialLayerEdited vle = getVLE(); |
193 | 192 |
clearSelection(); |
... | ... | |
261 | 260 |
int index = 0; |
262 | 261 |
VectorialEditableAdapter vea = getVLE().getVEA(); |
263 | 262 |
try { |
264 |
int num = vea.getRowCount(); |
|
265 |
DefaultFeature df = new DefaultFeature(geometry, values, String |
|
266 |
.valueOf(num)); |
|
263 |
String newFID = vea.getNewFID(); |
|
264 |
DefaultFeature df = new DefaultFeature(geometry, values, newFID); |
|
267 | 265 |
index = vea.addRow(df, getName(), EditionEvent.GRAPHIC); |
268 | 266 |
} catch (ValidateRowException e) { |
269 |
// TODO Auto-generated catch block |
|
270 |
e.printStackTrace(); |
|
267 |
NotificationManager.addError(e); |
|
271 | 268 |
} catch (ReadDriverException e) { |
272 |
// TODO Auto-generated catch block |
|
273 |
e.printStackTrace(); |
|
269 |
NotificationManager.addError(e); |
|
274 | 270 |
} catch (ExpansionFileWriteException e) { |
275 |
// TODO Auto-generated catch block |
|
276 |
e.printStackTrace(); |
|
271 |
NotificationManager.addError(e); |
|
277 | 272 |
} |
278 | 273 |
return vea.getInversedIndex(index); |
279 | 274 |
} |
... | ... | |
381 | 376 |
VectorialEditableAdapter vea = vle.getVEA(); |
382 | 377 |
FBitSet selection = vea.getSelection(); |
383 | 378 |
selection.clear(); |
384 |
// vea.setSelectionImage(null);
|
|
385 |
// vea.setHandlersImage(null);
|
|
379 |
vea.setSelectionImage(null); |
|
380 |
vea.setHandlersImage(null); |
|
386 | 381 |
|
387 | 382 |
} |
388 | 383 |
|
Also available in: Unified diff