Revision 13882

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dxf/DXFMemoryDriver.java
87 87
import com.iver.cit.gvsig.exceptions.visitors.ProcessWriterVisitorException;
88 88
import com.iver.cit.gvsig.exceptions.visitors.StartWriterVisitorException;
89 89
import com.iver.cit.gvsig.exceptions.visitors.StopWriterVisitorException;
90
import com.iver.cit.gvsig.fmap.MapContext;
91 90
import com.iver.cit.gvsig.fmap.core.FPoint2D;
92 91
import com.iver.cit.gvsig.fmap.core.FPoint3D;
93 92
import com.iver.cit.gvsig.fmap.core.FPolygon2D;
......
641 640

  
642 641
		defaultLegend = LegendFactory
643 642
				.createVectorialUniqueValueLegend(getShapeType());
644
		defaultLegend.setFieldNames(new String[] {"Color"});
643
		defaultLegend.setClassifyingFieldNames(new String[] {"Color"});
645 644

  
646 645
		Logger.getAnonymousLogger().info("DXFMemoryDriver: should check if this is a text symbol");
647 646
		ISymbol myDefaultSymbol = SymbologyFactory.
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/db/utils/SingleVectorialDBConnectionManager.java
1 1
package com.iver.cit.gvsig.fmap.drivers.db.utils;
2 2

  
3
import java.sql.SQLException;
3 4
import java.util.ArrayList;
4 5
import java.util.HashMap;
5 6
import java.util.Iterator;
......
8 9

  
9 10
import com.iver.cit.gvsig.fmap.drivers.ConnectionFactory;
10 11
import com.iver.cit.gvsig.fmap.drivers.DBException;
12
import com.iver.cit.gvsig.fmap.drivers.IConnection;
11 13
import com.iver.cit.gvsig.fmap.drivers.IVectorialDatabaseDriver;
12
import com.iver.cit.gvsig.fmap.drivers.IConnection;
13 14
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
14 15

  
15 16
/**
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/db/utils/ConnectionWithParams.java
1 1
package com.iver.cit.gvsig.fmap.drivers.db.utils;
2 2

  
3
import java.sql.SQLException;
4

  
3 5
import org.apache.log4j.Logger;
4 6

  
5 7
import com.iver.cit.gvsig.fmap.drivers.ConnectionFactory;
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dgn/DgnMemoryDriver.java
520 520
		}
521 521

  
522 522
		defaultLegend = LegendFactory.createVectorialUniqueValueLegend(getShapeType());
523
		defaultLegend.setFieldNames(new String[] {"Color"} );
523
		defaultLegend.setClassifyingFieldNames(new String[] {"Color"} );
524 524

  
525 525

  
526 526
		ISymbol myDefaultSymbol = SymbologyFactory.
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/gml/GMLDriver.java
1 1
package com.iver.cit.gvsig.fmap.drivers.gml;
2 2

  
3
import java.awt.Color;
4
import java.awt.Font;
5 3
import java.io.File;
6 4
import java.util.ArrayList;
7 5
import java.util.Hashtable;
......
24 22
import com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol;
25 23
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol;
26 24
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
27
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
28
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
29 25
import com.iver.cit.gvsig.fmap.drivers.ConcreteMemoryDriver;
30 26
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
31 27
import com.iver.cit.gvsig.fmap.drivers.gml.FMAPGeometryFactory.FeatureWithAttributes;
......
74 70
 *
75 71
 * $Id$
76 72
 * $Log$
77
 * Revision 1.12  2007-03-20 16:09:41  jaume
73
 * Revision 1.13  2007-09-19 16:25:05  jaume
74
 * ReadExpansionFileException removed from this context
75
 *
76
 * Revision 1.12  2007/03/20 16:09:41  jaume
78 77
 * refactored to use ISymbol instead of FSymbol
79 78
 *
80 79
 * Revision 1.11  2007/03/06 17:08:56  caballero
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/kml/KmlFMapDriver.java
1 1
package com.iver.cit.gvsig.fmap.drivers.kml;
2 2

  
3 3
import java.awt.Color;
4
import java.awt.Font;
5 4
import java.io.BufferedInputStream;
6 5
import java.io.File;
7 6
import java.io.FileInputStream;
......
35 34
import com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol;
36 35
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol;
37 36
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
38
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
39
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
40 37
import com.iver.cit.gvsig.fmap.drivers.ConcreteMemoryDriver;
41 38
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
42 39
import com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend;
......
91 88
 *
92 89
 * $Id$
93 90
 * $Log$
94
 * Revision 1.6  2007-05-28 15:36:42  jaume
91
 * Revision 1.7  2007-09-19 16:25:04  jaume
92
 * ReadExpansionFileException removed from this context
93
 *
94
 * Revision 1.6  2007/05/28 15:36:42  jaume
95 95
 * *** empty log message ***
96 96
 *
97 97
 * Revision 1.5  2007/05/17 09:32:06  jaume
......
337 337
	public ILegend getDefaultLegend() {
338 338
		if (defaultLegend == null){
339 339
			defaultLegend = LegendFactory.createVectorialUniqueValueLegend(getShapeType());
340
			defaultLegend.setFieldNames(new String[] {KmlTags.FOLDER_NAME});
340
			defaultLegend.setClassifyingFieldNames(new String[] {KmlTags.FOLDER_NAME});
341 341
//			this is never more handled by the legend, use a LabelingStrategy instead
342 342
//			defaultLegend.setLabelField(null);
343 343
//			defaultLegend.setLabelHeightField(null);
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/featureiterators/ReprojectWrapperFeatureIterator.java
45 45
*
46 46
* $Id$
47 47
* $Log$
48
* Revision 1.1  2007-06-07 11:49:28  azabala
48
* Revision 1.2  2007-09-19 16:25:04  jaume
49
* ReadExpansionFileException removed from this context
50
*
51
* Revision 1.1  2007/06/07 11:49:28  azabala
49 52
* first version in cvs
50 53
*
51 54
*
......
56 59
import org.cresques.cts.IProjection;
57 60

  
58 61
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
59
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
60 62
import com.iver.cit.gvsig.fmap.core.IFeature;
61 63
import com.iver.cit.gvsig.fmap.core.IGeometry;
62 64
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator;
......
82 84
		this.targetProjection = targetProj;
83 85
	}
84 86

  
85
	public boolean hasNext() throws ReadDriverException, ExpansionFileReadException {
87
	public boolean hasNext() throws ReadDriverException {
86 88
		return featureIterator.hasNext();
87 89
	}
88 90

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/featureiterators/DefaultFeatureIterator.java
45 45
*
46 46
* $Id$
47 47
* $Log$
48
* Revision 1.4  2007-06-07 11:49:39  azabala
48
* Revision 1.5  2007-09-19 16:25:04  jaume
49
* ReadExpansionFileException removed from this context
50
*
51
* Revision 1.4  2007/06/07 11:49:39  azabala
49 52
* added default constructor
50 53
*
51 54
* Revision 1.3  2007/06/07 10:19:56  azabala
......
160 163
	public DefaultFeatureIterator(){
161 164
	}
162 165
	
163
	public boolean hasNext() throws ReadDriverException,
164
			ExpansionFileReadException {
166
	public boolean hasNext() throws ReadDriverException {
165 167
		boolean bMore = (currentFeature < source.getShapeCount());
166 168
		return bMore;
167 169
	}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableAdapter.java
45 45
 *
46 46
 * $Id$
47 47
 * $Log$
48
 * Revision 1.75  2007-07-25 06:52:08  caballero
48
 * Revision 1.76  2007-09-19 16:25:04  jaume
49
 * ReadExpansionFileException removed from this context
50
 *
51
 * Revision 1.75  2007/07/25 06:52:08  caballero
49 52
 * reproject
50 53
 *
51 54
 * Revision 1.74  2007/06/22 10:52:30  caballero
......
277 280
import com.hardcode.driverManager.Driver;
278 281
import com.hardcode.gdbms.driver.exceptions.InitializeDriverException;
279 282
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
280
import com.hardcode.gdbms.driver.exceptions.ReloadDriverException;
281 283
import com.hardcode.gdbms.engine.data.DataSource;
282 284
import com.hardcode.gdbms.engine.data.driver.DriverException;
283 285
import com.hardcode.gdbms.engine.values.Value;
......
499 501
			}
500 502
		} catch (ReadDriverException e) {
501 503
			throw new StartWriterVisitorException(writer.getName(),e);
502
		} catch (OpenExpansionFileException e) {
503
			throw new StartWriterVisitorException(writer.getName(),e);
504
		} catch (ExpansionFileReadException e) {
505
			throw new StartWriterVisitorException(writer.getName(),e);
506
		}
504
		} 
507 505

  
508 506
		System.err.println("Se han metido en el ?ndice "
509 507
				+ index.queryAll().size() + " geometr?as");
......
689 687
	public void undoModifyRow(int calculatedIndex,
690 688
			int previousExpansionFileIndex, int sourceType) throws EditionCommandException{
691 689
		try {
692
		// Llega el CalculatedIndex
693
		/*
694
		 * Si la acci?n de modificar se realiz? sobre una geometr?a original
695
		 */
696
		if (previousExpansionFileIndex == -1) {
690
			// Llega el CalculatedIndex
691
			/*
692
			 * Si la acci?n de modificar se realiz? sobre una geometr?a original
693
			 */
694
			if (previousExpansionFileIndex == -1) {
697 695

  
698
			// Se obtiene la geometr?a para actualizar el ?ndice
699
			// IGeometry g = ((DefaultFeature)
700
			// getRow(calculatedIndex).getLinkedRow()).getGeometry();
701
			int inverse = getInversedIndex(calculatedIndex);
702
			DefaultFeature df;
696
				// Se obtiene la geometr?a para actualizar el ?ndice
697
				// IGeometry g = ((DefaultFeature)
698
				// getRow(calculatedIndex).getLinkedRow()).getGeometry();
699
				int inverse = getInversedIndex(calculatedIndex);
700
				DefaultFeature df;
703 701

  
704 702
				df = (DefaultFeature) getRow(inverse).getLinkedRow();
705 703

  
706
			boolean cancel = fireBeforeModifyRow(df, calculatedIndex,
707
					sourceType);
708
			if (cancel)
709
				return;
710
			IGeometry g = df.getGeometry();
711
			// IGeometry g = ova.getShape(calculatedIndex);
712
			Rectangle2D r = g.getBounds2D();
704
				boolean cancel = fireBeforeModifyRow(df, calculatedIndex,
705
						sourceType);
706
				if (cancel)
707
					return;
708
				IGeometry g = df.getGeometry();
709
				// IGeometry g = ova.getShape(calculatedIndex);
710
				Rectangle2D r = g.getBounds2D();
713 711

  
714
			// Se elimina de las relaciones y del fichero de expansi?n
715
			relations.remove(new Integer(calculatedIndex));
716
			expansionFile.deleteLastRow();
717
			if (sourceType == EditionEvent.GRAPHIC) {
718
				// Se actualizan los ?ndices
719
				IGeometry gAnt = ova.getShape(calculatedIndex);
720
				/*
721
				 * IGeometry gAnt = ((DefaultFeature) getRow(calculatedIndex)
722
				 * .getLinkedRow()).getGeometry();
723
				 */
724
				Rectangle2D rAnt = gAnt.getBounds2D();
725
				this.index.remove(new Envelope(r.getX(), r.getX()
726
						+ r.getWidth(), r.getY(), r.getY() + r.getHeight()),
727
						new Integer(calculatedIndex));
728
				this.index.insert(new Envelope(rAnt.getX(), rAnt.getX()
729
						+ rAnt.getWidth(), rAnt.getY(), rAnt.getY()
730
						+ rAnt.getHeight()), new Integer(calculatedIndex));
731
			}
732
		} else {
733
			// Se obtiene la geometr?a para actualizar el ?ndice
734
			IGeometry g = null;
735
			int inverse = getInversedIndex(calculatedIndex);
736
			DefaultFeature df = (DefaultFeature) getRow(inverse).getLinkedRow();
737
			boolean cancel = fireBeforeModifyRow(df, calculatedIndex,
738
					sourceType);
739
			if (cancel)
740
				return;
741
			if (sourceType == EditionEvent.GRAPHIC) {
742
				g = df.getGeometry();
743
				System.out.println("Actual: " + g.toString());
712
				// Se elimina de las relaciones y del fichero de expansi?n
713
				relations.remove(new Integer(calculatedIndex));
714
				expansionFile.deleteLastRow();
715
				if (sourceType == EditionEvent.GRAPHIC) {
716
					// Se actualizan los ?ndices
717
					IGeometry gAnt = ova.getShape(calculatedIndex);
718
					/*
719
					 * IGeometry gAnt = ((DefaultFeature) getRow(calculatedIndex)
720
					 * .getLinkedRow()).getGeometry();
721
					 */
722
					Rectangle2D rAnt = gAnt.getBounds2D();
723
					this.index.remove(new Envelope(r.getX(), r.getX()
724
							+ r.getWidth(), r.getY(), r.getY() + r.getHeight()),
725
							new Integer(calculatedIndex));
726
					this.index.insert(new Envelope(rAnt.getX(), rAnt.getX()
727
							+ rAnt.getWidth(), rAnt.getY(), rAnt.getY()
728
							+ rAnt.getHeight()), new Integer(calculatedIndex));
729
				}
730
			} else {
731
				// Se obtiene la geometr?a para actualizar el ?ndice
732
				IGeometry g = null;
733
				int inverse = getInversedIndex(calculatedIndex);
734
				DefaultFeature df = (DefaultFeature) getRow(inverse).getLinkedRow();
735
				boolean cancel = fireBeforeModifyRow(df, calculatedIndex,
736
						sourceType);
737
				if (cancel)
738
					return;
739
				if (sourceType == EditionEvent.GRAPHIC) {
740
					g = df.getGeometry();
741
					System.out.println("Actual: " + g.toString());
744 742

  
745
				Rectangle2D r = g.getBounds2D();
746
				this.index.remove(new Envelope(r.getX(), r.getX()
747
						+ r.getWidth(), r.getY(), r.getY() + r.getHeight()),
748
						new Integer(calculatedIndex));
743
					Rectangle2D r = g.getBounds2D();
744
					this.index.remove(new Envelope(r.getX(), r.getX()
745
							+ r.getWidth(), r.getY(), r.getY() + r.getHeight()),
746
							new Integer(calculatedIndex));
749 747

  
750
				// Se recupera la geometr?a
751
				// expansionFile.validateRow(previousExpansionFileIndex);
748
					// Se recupera la geometr?a
749
					// expansionFile.validateRow(previousExpansionFileIndex);
752 750

  
753
				// Se actualizan los ?ndices
754
				// g = ((IFeature)
755
				// (expansionFile.getRow(previousExpansionFileIndex).getLinkedRow())).getGeometry();
756
				// System.out.println("Anterior a la que volvemos : " +
757
				// g.toString());
758
				g = ((DefaultFeature) getRow(inverse).getLinkedRow())
759
						.getGeometry();
760
				r = g.getBounds2D();
761
				this.index.insert(new Envelope(r.getX(), r.getX()
762
						+ r.getWidth(), r.getY(), r.getY() + r.getHeight()),
763
						new Integer(calculatedIndex));
764
			}
765
			// Se actualiza la relaci?n de ?ndices
766
			// Integer integer = new Integer(geometryIndex);
767
			relations.put(new Integer(calculatedIndex), new Integer(
768
					previousExpansionFileIndex));
751
					// Se actualizan los ?ndices
752
					// g = ((IFeature)
753
					// (expansionFile.getRow(previousExpansionFileIndex).getLinkedRow())).getGeometry();
754
					// System.out.println("Anterior a la que volvemos : " +
755
					// g.toString());
756
					g = ((DefaultFeature) getRow(inverse).getLinkedRow())
757
					.getGeometry();
758
					r = g.getBounds2D();
759
					this.index.insert(new Envelope(r.getX(), r.getX()
760
							+ r.getWidth(), r.getY(), r.getY() + r.getHeight()),
761
							new Integer(calculatedIndex));
762
				}
763
				// Se actualiza la relaci?n de ?ndices
764
				// Integer integer = new Integer(geometryIndex);
765
				relations.put(new Integer(calculatedIndex), new Integer(
766
						previousExpansionFileIndex));
769 767

  
770
		}
768
			}
771 769
		} catch (ReadDriverException e) {
772 770
			throw new EditionCommandException(writer.getName(),e);
773
		} catch (ExpansionFileReadException e) {
774
			throw new EditionCommandException(writer.getName(),e);
775 771
		}
776 772
		//fireAfterModifyRow(calculatedIndex, sourceType);
777 773
	}
......
816 812
			g = ((IFeature) getRow(getInversedIndex(index)).getLinkedRow()).getGeometry();
817 813
		} catch (ReadDriverException e) {
818 814
			throw new EditionCommandException(writer.getName(),e);
819
		} catch (ExpansionFileReadException e) {
820
			throw new EditionCommandException(writer.getName(),e);
821
		}
815
		} 
822 816

  
823 817
		Rectangle2D r = g.getBounds2D();
824 818
		this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(), r
......
850 844
			setSelection(new FBitSet());
851 845
		} catch (ReadDriverException e) {
852 846
			throw new EditionCommandException(writer.getName(),e);
853
		} catch (ExpansionFileReadException e) {
854
			throw new EditionCommandException(writer.getName(),e);
855
		}
847
		} 
856 848
	}
857 849

  
858 850
	/**
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableDBAdapter.java
26 26
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator;
27 27
import com.iver.cit.gvsig.fmap.drivers.IVectorialDatabaseDriver;
28 28
import com.iver.cit.gvsig.fmap.drivers.featureiterators.AttrQueryFeatureIterator;
29
import com.iver.cit.gvsig.fmap.drivers.featureiterators.DefaultFeatureIterator;
30
import com.iver.cit.gvsig.fmap.drivers.featureiterators.IndexedSptQueryFeatureIterator;
31
import com.iver.cit.gvsig.fmap.drivers.featureiterators.SpatialQueryFeatureIterator;
32 29
import com.iver.cit.gvsig.fmap.layers.ISpatialDB;
33 30
import com.iver.cit.gvsig.fmap.layers.VectorialDBAdapter;
34 31
import com.vividsolutions.jts.geom.Envelope;
......
102 99

  
103 100

  
104 101

  
105
		public boolean hasNext() throws ReadDriverException, ExpansionFileReadException {
102
		public boolean hasNext() throws ReadDriverException {
106 103
			feat = null;
107 104
			int calculatedIndex = -1;
108 105
			if (bOriginalCursorOpened) // Si hay originales (Es porque si se ha
......
147 144
							alreadyDone.put(integer, feat);
148 145
						} else { // Si est? en el fichero de expansi?n
149 146
							int num = ((Integer) relations.get(integer)).intValue();
150
							IRowEdited auxR;
151
							auxR = expansionFile.getRow(num);
147
							IRowEdited auxR = null;
148
							try {
149
								auxR = expansionFile.getRow(num);
150
							} catch (ExpansionFileReadException e) {
151
								// TODO Auto-generated catch block
152
								e.printStackTrace();
153
							}
152 154
							feat = (IFeature) auxR.getLinkedRow().cloneRow();
153 155
							// feat = (IFeature) auxR.getLinkedRow();
154 156
							alreadyDone.put(integer, feat);
......
330 332
			 */
331 333
		} catch (ReadDriverException e) {
332 334
			throw new StartWriterVisitorException(writer.getName(),e);
333
		} catch (ExpansionFileReadException e) {
334
			throw new StartWriterVisitorException(writer.getName(),e);
335
		} catch (OpenExpansionFileException e) {
336
			throw new StartWriterVisitorException(writer.getName(),e);
337
		}
335
		} 
338 336

  
339 337
		System.err.println("Se han metido en el ?ndice "
340 338
				+ index.queryAll().size() + " geometr?as");
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/AnnotationEditableAdapter.java
19 19
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
20 20
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileWriteException;
21 21
import com.iver.cit.gvsig.exceptions.expansionfile.OpenExpansionFileException;
22
import com.iver.cit.gvsig.exceptions.layers.StartEditionLayerException;
23 22
import com.iver.cit.gvsig.exceptions.visitors.StartWriterVisitorException;
24 23
import com.iver.cit.gvsig.exceptions.visitors.StopWriterVisitorException;
25 24
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
......
408 407
	        }
409 408
		}  catch (ReadDriverException e) {
410 409
			throw new EditionCommandException(writer.getName(),e);
411
		} catch (ExpansionFileReadException e) {
412
			throw new EditionCommandException(writer.getName(),e);
413
		}
410
		} 
414 411
		fireAfterModifyRow(calculatedIndex, sourceType);
415 412
	}
416 413

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/writers/shp/Prueba.java
6 6

  
7 7
import com.hardcode.driverManager.DriverLoadException;
8 8
import com.hardcode.driverManager.DriverManager;
9
import com.hardcode.gdbms.driver.exceptions.InitializeDriverException;
10 9
import com.hardcode.gdbms.driver.exceptions.InitializeWriterException;
11
import com.hardcode.gdbms.driver.exceptions.OpenDriverException;
12 10
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
13 11
import com.hardcode.gdbms.engine.values.Value;
14 12
import com.hardcode.gdbms.engine.values.ValueFactory;
15
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileWriteException;
16 13
import com.iver.cit.gvsig.exceptions.layers.LegendLayerException;
17
import com.iver.cit.gvsig.exceptions.layers.StartEditionLayerException;
18
import com.iver.cit.gvsig.exceptions.layers.StopEditionLayerException;
19 14
import com.iver.cit.gvsig.exceptions.validate.ValidateRowException;
20 15
import com.iver.cit.gvsig.exceptions.visitors.StartWriterVisitorException;
21 16
import com.iver.cit.gvsig.exceptions.visitors.StopWriterVisitorException;
......
31 26
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
32 27
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
33 28
import com.iver.cit.gvsig.fmap.layers.VectorialFileAdapter;
29
import com.iver.cit.gvsig.fmap.rendering.IVectorLegend;
34 30
import com.iver.cit.gvsig.fmap.rendering.LegendFactory;
35
import com.iver.cit.gvsig.fmap.rendering.IVectorialLegend;
36 31

  
37 32

  
38 33
public class Prueba {
39 34

  
40 35
	public FLayer createLayer(String layerName, VectorialFileDriver d,
41 36
			File f, IProjection proj) throws ReadDriverException {
42
			VectorialFileAdapter adapter = new VectorialFileAdapter(f);
43
			adapter.setDriver((VectorialDriver) d);
44
			VectorialEditableAdapter vea=new VectorialEditableAdapter();
45
			vea.setOriginalVectorialAdapter(adapter);
46
			//FileEditableFeatureSource fefs=new FileEditableFeatureSource((VectorialFileAdapter)adapter);
47
			//MemoryExpansionFile mef=new MemoryExpansionFile();
48
			//DefaultEditableFeatureSource defs=new DefaultEditableFeatureSource(mef,fefs, new FBitSet());
37
		VectorialFileAdapter adapter = new VectorialFileAdapter(f);
38
		adapter.setDriver((VectorialDriver) d);
39
		VectorialEditableAdapter vea=new VectorialEditableAdapter();
40
		vea.setOriginalVectorialAdapter(adapter);
41
		//FileEditableFeatureSource fefs=new FileEditableFeatureSource((VectorialFileAdapter)adapter);
42
		//MemoryExpansionFile mef=new MemoryExpansionFile();
43
		//DefaultEditableFeatureSource defs=new DefaultEditableFeatureSource(mef,fefs, new FBitSet());
49 44

  
50
				//vea.start();
45
		//vea.start();
51 46

  
52 47

  
53 48

  
54 49

  
55 50

  
56
			FLyrVect capa = new FLyrVect();
57
			capa.setName(layerName);
51
		FLyrVect capa = new FLyrVect();
52
		capa.setName(layerName);
58 53

  
59
			//TODO Meter esto dentro de la comprobaci?n de si hay memoria
60
			if (false) {
54
		//TODO Meter esto dentro de la comprobaci?n de si hay memoria
55
		if (false) {
56
		} else {
57
			capa.setSource(adapter);
58
			capa.setProjection(proj);
59
		}
60

  
61
		try {
62
			// Le asignamos tambi?n una legenda por defecto acorde con
63
			// el tipo de shape que tenga. Tampoco s? si es aqu? el
64
			// sitio adecuado, pero en fin....
65
			if (d instanceof WithDefaultLegend) {
66
				WithDefaultLegend aux = (WithDefaultLegend) d;
67
				adapter.start();
68
				capa.setLegend((IVectorLegend) aux.getDefaultLegend());
69
				adapter.stop();
61 70
			} else {
62
				capa.setSource(adapter);
63
				capa.setProjection(proj);
71
				capa.setLegend(LegendFactory.createSingleSymbolLegend(
72
						capa.getShapeType()));
64 73
			}
65

  
66
			try {
67
				// Le asignamos tambi?n una legenda por defecto acorde con
68
				// el tipo de shape que tenga. Tampoco s? si es aqu? el
69
				// sitio adecuado, pero en fin....
70
				if (d instanceof WithDefaultLegend) {
71
					WithDefaultLegend aux = (WithDefaultLegend) d;
72
					adapter.start();
73
					capa.setLegend((IVectorialLegend) aux.getDefaultLegend());
74
					adapter.stop();
75
				} else {
76
					capa.setLegend(LegendFactory.createSingleSymbolLegend(
77
							capa.getShapeType()));
78
				}
79
			} catch (ReadDriverException e) {
80
				e.printStackTrace();
81
			} catch (LegendLayerException e) {
82
				// TODO Auto-generated catch block
83
				e.printStackTrace();
84
			}
85
			try {
86
				vea.startEdition(EditionEvent.GRAPHIC);
87
			} catch (StartWriterVisitorException e2) {
88
				e2.printStackTrace();
89
			}
90
			try {
74
			vea.startEdition(EditionEvent.GRAPHIC);
91 75
			Value[] values=new Value[5];
92 76
			values[0]=ValueFactory.createValue("hola0");
93 77
			values[1]=ValueFactory.createValue("hola1");
......
102 86
			vea.addRow(df2,"", EditionEvent.GRAPHIC);
103 87
			DefaultFeature df3=new DefaultFeature(ShapeFactory.createPoint2D(4,6),values);
104 88
			vea.addRow(df3,"", EditionEvent.GRAPHIC);
105
			} catch (ValidateRowException e) {
106
				e.printStackTrace();
107
			} catch (ReadDriverException e) {
108
				// TODO Auto-generated catch block
109
				e.printStackTrace();
110
			} catch (ExpansionFileWriteException e) {
111
				// TODO Auto-generated catch block
112
				e.printStackTrace();
113
			}
114
				ShpWriter writer=null;
115
				try {
116
					writer = (ShpWriter)LayerFactory.getWM().getWriter("Shape Writer");
117
				} catch (DriverLoadException e1) {
118
					// TODO Auto-generated catch block
119
					e1.printStackTrace();
120
				}
121
				try {
122
					writer.initialize(capa);
123
				} catch (InitializeWriterException e) {
124
					e.printStackTrace();
125
				}
126
				try {
127
					vea.stopEdition(writer,EditionEvent.GRAPHIC);
128
				} catch (StopWriterVisitorException e) {
129
					e.printStackTrace();
130
				}
131
			return null;
89
			ShpWriter writer=null;
90

  
91
			writer = (ShpWriter)LayerFactory.getWM().getWriter("Shape Writer");
92
			writer.initialize(capa);
93
			vea.stopEdition(writer,EditionEvent.GRAPHIC);
94
		} catch (ReadDriverException e) {
95
			e.printStackTrace();
96
		} catch (LegendLayerException e) {
97
			// TODO Auto-generated catch block
98
			e.printStackTrace();
99
		} catch (ValidateRowException e) {
100
			e.printStackTrace();
101
		} catch (StartWriterVisitorException e) {
102
			// TODO Auto-generated catch block
103
			e.printStackTrace();
104
		} catch (DriverLoadException e1) {
105
			// TODO Auto-generated catch block
106
			e1.printStackTrace();
107

  
108
		} catch (InitializeWriterException e) {
109
			e.printStackTrace();
110
		} catch (StopWriterVisitorException e) {
111
			e.printStackTrace();
132 112
		}
113
		return null;
114
	}
115
	
133 116
	public static void main(String[] args) {
134 117
		DriverManager driverManager = LayerFactory.getDM();
135 118
		driverManager.loadDrivers(new File("d:/eclipse/workspace/fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers"));
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/writers/shp/MultiShpWriter.java
6 6

  
7 7
import com.hardcode.gdbms.driver.exceptions.InitializeWriterException;
8 8
import com.hardcode.gdbms.driver.exceptions.SchemaEditionException;
9
import com.iver.cit.gvsig.exceptions.visitors.ProcessVisitorException;
10 9
import com.iver.cit.gvsig.exceptions.visitors.ProcessWriterVisitorException;
11 10
import com.iver.cit.gvsig.exceptions.visitors.StartWriterVisitorException;
12 11
import com.iver.cit.gvsig.exceptions.visitors.StopWriterVisitorException;
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/commands/RemoveRowCommand.java
8 8
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
9 9
import com.iver.cit.gvsig.fmap.edition.EditableAdapter;
10 10
import com.iver.cit.gvsig.fmap.edition.EditionEvent;
11
import com.iver.cit.gvsig.fmap.edition.IEditableSource;
12 11

  
13 12
public class RemoveRowCommand extends AbstractCommand {
14 13

  
......
40 39
			efs.doRemoveRow(index,sourceType);
41 40
		} catch (ReadDriverException e) {
42 41
			throw new EditionCommandException(efs.getWriter().getName(),e);
43
		} catch (ExpansionFileReadException e) {
44
			throw new EditionCommandException(efs.getWriter().getName(),e);
45
		}
42
		} 
46 43
	}
47 44

  
48 45
	public String getType() {
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/commands/ModifyRowCommand.java
10 10
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
11 11
import com.iver.cit.gvsig.fmap.edition.EditableAdapter;
12 12
import com.iver.cit.gvsig.fmap.edition.EditionEvent;
13
import com.iver.cit.gvsig.fmap.edition.IEditableSource;
14 13

  
15 14
public class ModifyRowCommand extends AbstractCommand {
16 15

  
......
55 54
			throw new EditionCommandException(efs.getWriter().getName(),e);
56 55
		} catch (ReadDriverException e) {
57 56
			throw new EditionCommandException(efs.getWriter().getName(),e);
58
		} catch (ExpansionFileReadException e) {
59
			throw new EditionCommandException(efs.getWriter().getName(),e);
60 57
		}
61 58
	}
62 59
	public String getType() {
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/commands/AddRowCommand.java
9 9
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
10 10
import com.iver.cit.gvsig.fmap.edition.EditableAdapter;
11 11
import com.iver.cit.gvsig.fmap.edition.EditionEvent;
12
import com.iver.cit.gvsig.fmap.edition.IEditableSource;
13 12

  
14 13
/**
15 14
 * A?ade una geometr?a nueva al EditableFeatureSource
......
47 46
			calculatedIndex=efs.doAddRow(row, sourceType);
48 47
		} catch (ReadDriverException e) {
49 48
			throw new EditionCommandException(efs.getWriter().getName(),e);
50
		} catch (ExpansionFileWriteException e) {
51
			throw new EditionCommandException(efs.getWriter().getName(),e);
52
		}
49
		} 
53 50
	}
54 51

  
55 52
	public String getType() {
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/EditableAdapter.java
26 26
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileWriteException;
27 27
import com.iver.cit.gvsig.exceptions.layers.CancelEditingLayerException;
28 28
import com.iver.cit.gvsig.exceptions.layers.StartEditionLayerException;
29
import com.iver.cit.gvsig.exceptions.layers.StopEditionLayerException;
30 29
import com.iver.cit.gvsig.exceptions.validate.ValidateRowException;
31 30
import com.iver.cit.gvsig.exceptions.visitors.StartWriterVisitorException;
32 31
import com.iver.cit.gvsig.exceptions.visitors.StopWriterVisitorException;
......
397 396

  
398 397
		} catch (ReadDriverException e) {
399 398
			throw new StopWriterVisitorException(writer.getName(),e);
400
		} catch (ExpansionFileReadException e) {
401
			throw new StopWriterVisitorException(writer.getName(),e);
402 399
		} catch (StartWriterVisitorException e) {
403 400
			throw new StopWriterVisitorException(writer.getName(),e);
404 401
		} catch (VisitorException e) {

Also available in: Unified diff