Revision 10627 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrAnnotation.java

View differences:

FLyrAnnotation.java
7 7
import java.awt.geom.Rectangle2D;
8 8
import java.awt.image.BufferedImage;
9 9
import java.io.File;
10
import java.io.IOException;
11 10
import java.util.ArrayList;
12 11

  
13 12
import javax.print.attribute.PrintRequestAttributeSet;
......
17 16

  
18 17
import com.hardcode.driverManager.Driver;
19 18
import com.hardcode.driverManager.DriverLoadException;
20
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException;
19
import com.hardcode.gdbms.driver.exceptions.InitializeDriverException;
20
import com.hardcode.gdbms.driver.exceptions.OpenDriverException;
21
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
22
import com.hardcode.gdbms.engine.data.driver.DriverException;
21 23
import com.hardcode.gdbms.engine.values.IntValue;
22 24
import com.hardcode.gdbms.engine.values.NullValue;
23 25
import com.hardcode.gdbms.engine.values.NumericValue;
24 26
import com.hardcode.gdbms.engine.values.StringValue;
25 27
import com.hardcode.gdbms.engine.values.Value;
26 28
import com.hardcode.gdbms.engine.values.ValueFactory;
27
import com.iver.cit.gvsig.fmap.DriverException;
29
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
30
import com.iver.cit.gvsig.exceptions.layers.LegendLayerException;
31
import com.iver.cit.gvsig.exceptions.visitors.VisitorException;
28 32
import com.iver.cit.gvsig.fmap.ViewPort;
29 33
import com.iver.cit.gvsig.fmap.core.IGeometry;
30 34
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
......
34 38
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
35 39
import com.iver.cit.gvsig.fmap.drivers.BoundedShapes;
36 40
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes;
37
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
38 41
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver;
39 42
import com.iver.cit.gvsig.fmap.edition.AnnotationEditableAdapter;
40 43
import com.iver.cit.gvsig.fmap.operations.strategies.AnnotationStrategy;
41 44
import com.iver.cit.gvsig.fmap.operations.strategies.Strategy;
42 45
import com.iver.cit.gvsig.fmap.operations.strategies.StrategyManager;
43
import com.iver.cit.gvsig.fmap.operations.strategies.VisitException;
44 46
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
45 47
import com.iver.cit.gvsig.fmap.spatialindex.QuadtreeJts;
46 48
import com.iver.utiles.XMLEntity;
......
79 81
		try {
80 82
			setLegend();
81 83
			createLabels();
82
		} catch (DriverException e) {
84
		} catch (ReadDriverException e) {
83 85
			e.printStackTrace();
84 86
		}
85 87
	}
......
98 100
	 *      java.awt.Graphics2D, ISymbol)
99 101
	 */
100 102
	public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
101
			Cancellable cancel, double scale) throws DriverException {
103
			Cancellable cancel, double scale) throws ReadDriverException {
102 104
		if (isWithinScale(scale)) {
103 105
			// Las que solo tienen etiquetado sin pintar el shape,
104 106
			// no pasamos por ellas
......
115 117
					if (getISpatialIndex()==null) {
116 118
						createSpatialIndex();
117 119
					}
118
				} catch (DriverException e) {
120
				} catch (ReadDriverException e) {
119 121
					this.setVisible(false);
120 122
					this.setActive(false);
121 123
					throw e;
......
129 131
	}
130 132

  
131 133
	/**
134
	 * @throws ReadDriverException
135
	 * @throws ExpansionFileReadException
132 136
	 * @see com.iver.cit.gvsig.fmap.layers.LayerOperations#getFullExtent()
133 137
	 */
134
	public Rectangle2D getFullExtent() throws DriverException {
138
	public Rectangle2D getFullExtent() throws ReadDriverException, ExpansionFileReadException {
139
		Rectangle2D rAux;
140
		// logger.debug("source.start()");
135 141
		try {
136
			Rectangle2D rAux;
137

  
138
			// logger.debug("source.start()");
139 142
			getSource().start();
140
			rAux = getSource().getFullExtent();
141

  
143
		} catch (InitializeDriverException e) {
144
			throw new ReadDriverException(getName(),e);
145
		}
146
		rAux = getSource().getFullExtent();
142 147
			// logger.debug("source.stop()");
143
			getSource().stop();
144

  
148
		getSource().stop();
145 149
			// Si existe reproyecci?n, reproyectar el extent
146
			ICoordTrans ct = getCoordTrans();
147

  
148
			if (ct != null) {
149
				Point2D pt1 = new Point2D.Double(rAux.getMinX(), rAux.getMinY());
150
				Point2D pt2 = new Point2D.Double(rAux.getMaxX(), rAux.getMaxY());
151
				pt1 = ct.convert(pt1, null);
152
				pt2 = ct.convert(pt2, null);
153
				rAux = new Rectangle2D.Double();
154
				rAux.setFrameFromDiagonal(pt1, pt2);
155
			}
156

  
157
			return rAux;
158
		} catch (DriverIOException e) {
159
			throw new DriverException(e);
150
		ICoordTrans ct = getCoordTrans();
151
		if (ct != null) {
152
			Point2D pt1 = new Point2D.Double(rAux.getMinX(), rAux.getMinY());
153
			Point2D pt2 = new Point2D.Double(rAux.getMaxX(), rAux.getMaxY());
154
			pt1 = ct.convert(pt1, null);
155
			pt2 = ct.convert(pt2, null);
156
			rAux = new Rectangle2D.Double();
157
			rAux.setFrameFromDiagonal(pt1, pt2);
160 158
		}
159
		return rAux;
161 160
	}
162 161

  
163 162
	/**
......
166 165
	 *      com.iver.utiles.swing.threads.Cancellable)
167 166
	 */
168 167
	public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
169
			double scale, PrintRequestAttributeSet properties) throws DriverException {
168
			double scale, PrintRequestAttributeSet properties) throws ReadDriverException {
170 169
		if (isVisible() && isWithinScale(scale)) {
171 170
			Strategy strategy = StrategyManager.getStrategy(this);
172 171
			strategy.print(g, viewPort, cancel, properties);
......
178 177
	 *
179 178
	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.RandomVectorialData#queryByRect(java.awt.geom.Rectangle2D)
180 179
	 */
181
	public FBitSet queryByRect(Rectangle2D rect) throws DriverException {
180
	public FBitSet queryByRect(Rectangle2D rect) throws ReadDriverException, VisitorException {
182 181
		Strategy s = StrategyManager.getStrategy(this);
183 182

  
184 183
		return s.queryByRect(rect);
......
193 192
	 *            DOCUMENT ME!
194 193
	 *
195 194
	 * @return DOCUMENT ME!
196
	 *
197 195
	 * @throws DriverException
198 196
	 *             DOCUMENT ME!
199 197
	 */
200 198
	public FBitSet queryByPoint(Point2D p, double tolerance)
201
			throws DriverException {
199
			throws ReadDriverException, VisitorException {
202 200
		Strategy s = StrategyManager.getStrategy(this);
203 201

  
204 202
		return s.queryByPoint(p, tolerance);
......
212 210
	 * @param relationship
213 211
	 *            DOCUMENT ME!
214 212
	 *
215
	 * @return DOCUMENT ME!
216
	 *
217
	 * @throws DriverException
218
	 *             DOCUMENT ME!
219
	 * @throws VisitException
220
	 *             DOCUMENT ME!
213
	 * @return FBitset
221 214
	 */
222 215
	public FBitSet queryByShape(IGeometry g, int relationship)
223
			throws DriverException, VisitException {
216
			throws ReadDriverException, VisitorException {
224 217
		Strategy s = StrategyManager.getStrategy(this);
225 218

  
226 219
		return s.queryByShape(g, relationship);
......
288 281
		super.setXMLEntity(xml);
289 282
		try {
290 283
			createLabels();
291
		} catch (DriverException e) {
292
			// TODO Auto-generated catch block
284
		} catch (ReadDriverException e) {
293 285
			e.printStackTrace();
294 286
		}
295 287
	}
......
300 292
	 * colecci?n de FLabel (Patr?n Composite)
301 293
	 *
302 294
	 * @param lyrVect
295
	 * @throws ReadDriverException
303 296
	 * @throws DriverException
304 297
	 */
305
	private void createLabels() throws DriverException {
298
	private void createLabels() throws ReadDriverException{
306 299
		SelectableDataSource ds = getRecordset();
307 300
		FSymbol symbol;
308 301
		try {
......
444 437

  
445 438
			ds.stop();
446 439
			adapter.stop();
447
		} catch (DriverIOException e) {
448
			e.printStackTrace();
449
			throw new DriverException(e);
450
		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
451
			e.printStackTrace();
452
			throw new DriverException(e);
440
		} catch (ExpansionFileReadException e) {
441
			throw new ReadDriverException(getName(),e);
442
		} catch (InitializeDriverException e) {
443
			throw new ReadDriverException(getName(),e);
453 444
		}
454 445

  
455 446
	}
......
505 496
				}
506 497
			} // for
507 498
			va.stop();
508
		} catch (DriverIOException e) {
499
		} catch (ReadDriverException e) {
509 500
			e.printStackTrace();
510
		} catch (IOException e) {
501
		} catch (ExpansionFileReadException e) {
511 502
			e.printStackTrace();
512 503
		}
513 504
	}
514 505

  
515
	public void setSelectedEditing() throws DriverException {
506
	public void setSelectedEditing() throws ReadDriverException {
516 507
		FBitSet bitSet = getRecordset().getSelection();
517 508
		if (bitSet.cardinality() == 0)
518 509
			return;
......
548 539
			vuvl.setDefaultSymbol(new FSymbol(FConstant.SYMBOL_TYPE_TEXT));
549 540
			setLegend(vuvl);
550 541
			getSource().getRecordset().stop();
551
		} catch (FieldNotFoundException e) {
542
		} catch (LegendLayerException e) {
552 543
			e.printStackTrace();
553
		} catch (DriverException e) {
554
			e.printStackTrace();
555 544
		} catch (DriverLoadException e) {
556 545
			e.printStackTrace();
557
		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
546
		} catch (ReadDriverException e) {
558 547
			e.printStackTrace();
559 548
		}
560 549

  

Also available in: Unified diff