Revision 652 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/FMap.java
FMap.java | ||
---|---|---|
16 | 16 |
import org.cresques.geo.Projected; |
17 | 17 |
|
18 | 18 |
import com.hardcode.driverManager.DriverLoadException; |
19 |
import com.hardcode.gdbms.engine.data.DriverException; |
|
20 | 19 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
21 | 20 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
22 | 21 |
import com.iver.cit.gvsig.fmap.layers.CancelationException; |
... | ... | |
136 | 135 |
* @throws DriverException |
137 | 136 |
*/ |
138 | 137 |
public void print(Graphics2D g) |
139 |
throws DriverIOException, DriverLoadException, DriverException {
|
|
138 |
throws DriverException { |
|
140 | 139 |
///draw(null, g); |
141 | 140 |
layers.print(g, viewPort, |
142 | 141 |
new Cancellable() { |
... | ... | |
296 | 295 |
* double) |
297 | 296 |
*/ |
298 | 297 |
public void selectByPoint(Point2D p, double tolerance) |
299 |
throws DriverIOException {
|
|
298 |
throws DriverException { |
|
300 | 299 |
QueriedPoint qp = new QueriedPoint(p.getX(), p.getY()); |
301 | 300 |
Point2D mapPoint = viewPort.toMapPoint((int) p.getX(), (int) p.getY()); |
302 | 301 |
qp.setRealCoords(mapPoint.getX(), mapPoint.getY()); |
... | ... | |
315 | 314 |
* |
316 | 315 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#selectByRect(java.awt.geom.Rectangle2D) |
317 | 316 |
*/ |
318 |
public void selectByRect(Rectangle2D rect) throws DriverIOException {
|
|
317 |
public void selectByRect(Rectangle2D rect) throws DriverException { |
|
319 | 318 |
SelectByRectVisitor visitor = new SelectByRectVisitor(); |
320 | 319 |
visitor.setRect(rect); |
321 | 320 |
layers.process(visitor); |
... | ... | |
374 | 373 |
* java.awt.Graphics2D, FStyle2D) |
375 | 374 |
*/ |
376 | 375 |
public void draw(BufferedImage image, Graphics2D g, Cancellable cancel) |
377 |
throws DriverIOException, DriverLoadException, DriverException {
|
|
376 |
throws DriverException { |
|
378 | 377 |
if (viewPort.getExtent() == null) { |
379 | 378 |
return; |
380 | 379 |
} |
... | ... | |
396 | 395 |
* java.awt.Graphics2D, FStyle2D) |
397 | 396 |
*/ |
398 | 397 |
public void draw(BufferedImage image, Graphics2D g) |
399 |
throws DriverIOException, DriverLoadException, DriverException {
|
|
398 |
throws DriverException { |
|
400 | 399 |
layers.draw(image, g, viewPort, |
401 | 400 |
new Cancellable() { |
402 | 401 |
/** |
... | ... | |
433 | 432 |
* |
434 | 433 |
* @throws DriverIOException |
435 | 434 |
*/ |
436 |
public Rectangle2D getFullExtent() throws DriverIOException {
|
|
435 |
public Rectangle2D getFullExtent() throws DriverException { |
|
437 | 436 |
return layers.getFullExtent(); |
438 | 437 |
} |
439 | 438 |
|
... | ... | |
443 | 442 |
* @return DOCUMENT ME! |
444 | 443 |
* @throws DriverException |
445 | 444 |
*/ |
446 |
public XMLEntity getXMLEntity() throws DriverException {
|
|
445 |
public XMLEntity getXMLEntity() { |
|
447 | 446 |
XMLEntity xml = new XMLEntity(); |
448 | 447 |
xml.addChild(viewPort.getXMLEntity()); |
449 | 448 |
xml.putProperty("numLayers", layers.getLayersCount()); |
... | ... | |
467 | 466 |
* @throws XMLException DOCUMENT ME! |
468 | 467 |
*/ |
469 | 468 |
public static FMap createFromXML(XMLEntity xml) |
470 |
throws XMLException { |
|
469 |
throws XMLException, DriverException {
|
|
471 | 470 |
ViewPort vp = ViewPort.createFromXML(xml.getChild(0)); |
472 | 471 |
FMap fmap = new FMap(vp); |
473 | 472 |
|
... | ... | |
484 | 483 |
FLayer layer = null; |
485 | 484 |
String[] s=xml.getStringArrayProperty("LayerNames"); |
486 | 485 |
if (xml.getChild(1).getChild(i).getStringProperty("file") != null) { |
487 |
try { |
|
488 |
// TODO cambiar el "nombre" por el nombre de la capa |
|
489 |
layer = LayerFactory.createLayer(s[i], xml.getChild(1).getChild(i) |
|
490 |
.getStringProperty("driverName"), |
|
491 |
new File(xml.getChild(1).getChild(i) |
|
492 |
.getStringProperty("file")), proj); |
|
493 |
} catch (DriverLoadException e1) { |
|
494 |
throw new XMLException(e1); |
|
495 |
} catch (DriverIOException e1) { |
|
496 |
throw new XMLException(e1); |
|
497 |
} |
|
486 |
// TODO cambiar el "nombre" por el nombre de la capa |
|
487 |
layer = LayerFactory.createLayer(s[i], xml.getChild(1).getChild(i) |
|
488 |
.getStringProperty("driverName"), |
|
489 |
new File(xml.getChild(1).getChild(i) |
|
490 |
.getStringProperty("file")), proj); |
|
498 | 491 |
} else if (true) { |
499 | 492 |
} else if (true) { |
500 | 493 |
} |
501 | 494 |
|
502 |
try { |
|
503 |
layer.setXMLEntity(xml.getChild(1).getChild(i)); |
|
504 |
} catch (XMLException e) { |
|
505 |
throw new XMLException(e); |
|
506 |
} |
|
495 |
layer.setXMLEntity(xml.getChild(1).getChild(i)); |
|
507 | 496 |
|
508 |
try { |
|
509 |
fmap.getLayers().addLayer(layer); |
|
510 |
} catch (CancelationException e1) { |
|
511 |
throw new XMLException(e1); |
|
512 |
} |
|
497 |
fmap.getLayers().addLayer(layer); |
|
513 | 498 |
} |
514 | 499 |
|
515 | 500 |
return fmap; |
... | ... | |
614 | 599 |
|
615 | 600 |
try { |
616 | 601 |
getViewPort().setExtent(lyr.getFullExtent()); |
617 |
} catch (DriverIOException e1) {
|
|
602 |
} catch (DriverException e1) { |
|
618 | 603 |
} |
619 | 604 |
} |
620 | 605 |
|
Also available in: Unified diff