Revision 750

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/MapTool.java
10 10
import java.awt.image.BufferedImage;
11 11

  
12 12
import com.iver.cit.gvsig.fmap.NewMapControl;
13
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
13 14
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
14 15

  
15 16
/**
......
55 56
	/**
56 57
	 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
57 58
	 */
58
	public void mouseClicked(MouseEvent e) throws Throwable{
59
	public void mouseClicked(MouseEvent e) throws BehaviorException {
59 60
		
60 61
	}
61 62

  
62 63
	/**
63 64
	 * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
64 65
	 */
65
	public void mouseEntered(MouseEvent e) throws Throwable{
66
	public void mouseEntered(MouseEvent e) throws BehaviorException {
66 67
		
67 68
	}
68 69
	/**
69 70
	 * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
70 71
	 */
71
	public void mouseExited(MouseEvent e) throws Throwable{
72
	public void mouseExited(MouseEvent e) throws BehaviorException {
72 73
		
73 74
	}
74 75

  
75 76
	/**
76 77
	 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
77 78
	 */
78
	public void mousePressed(MouseEvent e) throws Throwable{
79
	public void mousePressed(MouseEvent e) throws BehaviorException {
79 80
		
80 81
	}
81 82

  
82 83
	/**
84
	 * @throws Exception
83 85
	 * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
84 86
	 */
85
	public void mouseReleased(MouseEvent e) throws Throwable{
87
	public void mouseReleased(MouseEvent e) throws BehaviorException {
86 88
		
87 89
	}
88 90

  
89 91
	/**
90 92
	 * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
91 93
	 */
92
	public void mouseDragged(MouseEvent e) throws Throwable{
94
	public void mouseDragged(MouseEvent e) throws BehaviorException {
93 95
		
94 96
	}
95 97

  
96 98
	/**
97 99
	 * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
98 100
	 */
99
	public void mouseMoved(MouseEvent e) throws Throwable{
101
	public void mouseMoved(MouseEvent e) throws BehaviorException {
100 102
		
101 103
	}
102 104

  
103 105
	/**
104 106
	 * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent)
105 107
	 */
106
	public void mouseWheelMoved(MouseWheelEvent e) throws Throwable{
108
	public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException {
107 109
		
108 110
	}
109 111
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/MeasureMapTool.java
8 8
import java.util.ArrayList;
9 9

  
10 10
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
11
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
11 12
import com.iver.cit.gvsig.fmap.tools.Events.MeasureEvent;
12 13
import com.iver.cit.gvsig.fmap.tools.Listeners.MeasureListener;
13 14
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
......
42 43
     * DOCUMENT ME!
43 44
     *
44 45
     * @param E DOCUMENT ME!
46
     * @throws BehaviorException
45 47
     */
46
    public void mousePressed(MouseEvent E) {
48
    public void mousePressed(MouseEvent E) throws BehaviorException {
47 49
        if (E.getClickCount() == 2) {
48 50
        	//System.err.println("dobleclick");
49 51
            listener.polylineFinished(new MeasureEvent((Double[]) arrayX.toArray(
......
64 66
        }
65 67
    }
66 68
    /**
67
	 * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
69
	 * @throws BehaviorException
70
     * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
68 71
	 */
69
	public void mouseDragged(MouseEvent e) {
72
	public void mouseDragged(MouseEvent e) throws BehaviorException {
70 73
		mouseMoved(e);
71 74
    }
72 75

  
......
84 87
     * DOCUMENT ME!
85 88
     *
86 89
     * @param E DOCUMENT ME!
90
     * @throws BehaviorException
87 91
     */
88
    public void mouseMoved(MouseEvent E) {
92
    public void mouseMoved(MouseEvent E) throws BehaviorException {
89 93
    	//System.err.println("moved antes de click");
90 94
        if (isClicked) {
91 95
        	//System.err.println("moved despues de click");
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/RectangleMapTool.java
10 10
import java.awt.image.BufferedImage;
11 11

  
12 12
import com.iver.cit.gvsig.fmap.ViewPort;
13
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
13 14
import com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent;
14 15
import com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener;
15 16
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
......
67 68
    }
68 69

  
69 70
    /**
71
     * @throws BehaviorException
70 72
     * @throws Exception
71 73
     * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
72 74
     */
73
    public void mouseReleased(MouseEvent e) throws Exception {
75
    public void mouseReleased(MouseEvent e) throws BehaviorException {
74 76
        Point2D p1;
75 77
        Point2D p2;
76 78
        Point pScreen = e.getPoint();
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/MoveMapTool.java
6 6
import java.awt.event.MouseEvent;
7 7
import java.awt.geom.Point2D;
8 8

  
9
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
9 10
import com.iver.cit.gvsig.fmap.tools.Events.MoveEvent;
10 11
import com.iver.cit.gvsig.fmap.tools.Listeners.MoveListener;
11 12
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
......
61 62
    }
62 63

  
63 64
    /**
65
     * @throws BehaviorException
64 66
     * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
65 67
     */
66
    public void mouseReleased(MouseEvent e) {
68
    public void mouseReleased(MouseEvent e) throws BehaviorException {
67 69
        Point2D p1;
68 70
        Point2D p2;
69 71
        if (e.getButton() == MouseEvent.BUTTON1) {
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/AreaMapTool.java
1 1
package com.iver.cit.gvsig.fmap.tools.Behavior;
2 2

  
3
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
3 4
import com.iver.cit.gvsig.fmap.tools.Events.MeasureEvent;
4 5

  
5 6
import java.awt.Color;
......
31 32
	 * DOCUMENT ME!
32 33
	 *
33 34
	 * @param E DOCUMENT ME!
35
	 * @throws BehaviorException
34 36
	 */
35
	public void mousePressed(MouseEvent E) {
37
	public void mousePressed(MouseEvent E) throws BehaviorException {
36 38
		if (E.getClickCount() == 2) {
37 39
			listener.polylineFinished(new MeasureEvent(
38 40
					(Double[]) arrayX.toArray(new Double[0]),
......
83 85
	 * DOCUMENT ME!
84 86
	 *
85 87
	 * @param E DOCUMENT ME!
88
	 * @throws BehaviorException
86 89
	 */
87
	public void mouseMoved(MouseEvent E) {
90
	public void mouseMoved(MouseEvent E) throws BehaviorException {
88 91
		if (isClicked) {
89 92
			changeAntPoint(E.getPoint());
90 93

  
......
96 99
	}
97 100

  
98 101
	/**
102
	 * @throws BehaviorException
99 103
	 * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
100 104
	 */
101
	public void mouseDragged(MouseEvent e) {
105
	public void mouseDragged(MouseEvent e) throws BehaviorException {
102 106
		mouseMoved(e);
103 107
	}
104 108
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/PointMapTool.java
4 4
import java.awt.event.MouseEvent;
5 5
import java.awt.geom.Point2D;
6 6

  
7
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
7 8
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent;
8 9
import com.iver.cit.gvsig.fmap.tools.Listeners.PointListener;
9 10
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
......
27 28
	}
28 29
	
29 30
    /**
31
     * @throws BehaviorException
30 32
     * @throws Exception
31 33
     * @throws Exception
32 34
     * @see com.iver.cit.gvsig.fmap.tools.Behavior.MapTool#mouseReleased(java.awt.event.MouseEvent)
33 35
     */
34
    public void mouseReleased(MouseEvent e) throws Exception{
36
    public void mouseReleased(MouseEvent e) throws BehaviorException {
35 37
        Point2D p1;
36 38
        Point2D p2;
37 39
        Point pScreen = e.getPoint();
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/RectangleSelectionListener.java
34 34
	 * @throws DriverIOException
35 35
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener#rectangle(com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent)
36 36
	 */
37
	public void rectangle(RectangleEvent event) throws DriverException{
38
		mapCtrl.getMapContext().selectByRect(event.getRect());
39
		mapCtrl.drawMap();
37
	public void rectangle(RectangleEvent event) throws BehaviorException{
38
		try {
39
			mapCtrl.getMapContext().selectByRect(event.getRect());
40
		} catch (DriverException e) {
41
			throw new BehaviorException("No se pudo hacer la selecci?n");
42
		}
40 43
	}
41 44

  
42 45
	/**
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/PointSelectionListener.java
32 32
    }
33 33

  
34 34
	/**
35
	 * @throws BehaviorException
35 36
	 * @throws DriverIOException
36 37
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
37 38
	 */
38
	public void point(PointEvent event) throws DriverException {
39
		mapCtrl.getMapContext().selectByPoint(event.getPoint(), 1);
40
		mapCtrl.drawMap();
39
	public void point(PointEvent event) throws BehaviorException {
40
		try {
41
			mapCtrl.getMapContext().selectByPoint(event.getPoint(), 1);
42
		} catch (DriverException e) {
43
			throw new BehaviorException("No se pudo hacer la selecci?n");
44
		}
41 45
	}
42 46

  
43 47
	/**
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Listeners/MoveListener.java
1 1
package com.iver.cit.gvsig.fmap.tools.Listeners;
2 2

  
3
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
3 4
import com.iver.cit.gvsig.fmap.tools.Events.MoveEvent;
4 5

  
5 6

  
......
15 16
     * @param from DOCUMENT ME!
16 17
     * @param to DOCUMENT ME!
17 18
     */
18
    public void move(MoveEvent event);
19
    public void move(MoveEvent event) throws BehaviorException;
19 20
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Listeners/PointListener.java
1 1
package com.iver.cit.gvsig.fmap.tools.Listeners;
2 2

  
3 3
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
4
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
4 5
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent;
5 6

  
6 7
/**
......
15 16
     * @param event DOCUMENT ME!
16 17
     * @throws Exception
17 18
     */
18
    public void point(PointEvent event) throws Exception;
19
    public void point(PointEvent event) throws BehaviorException;
19 20
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Listeners/MeasureListener.java
1 1
package com.iver.cit.gvsig.fmap.tools.Listeners;
2 2

  
3
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
3 4
import com.iver.cit.gvsig.fmap.tools.Events.MeasureEvent;
4 5

  
5 6

  
......
15 16
     *
16 17
     * @param event DOCUMENT ME!
17 18
     */
18
    public void points(MeasureEvent event);
19
    public void points(MeasureEvent event) throws BehaviorException;
19 20

  
20 21
    /**
21 22
     * Invocado cuando el usuario hace click y fija un punto  de la polilinea
22 23
     *
23 24
     * @param event DOCUMENT ME!
24 25
     */
25
    public void pointFixed(MeasureEvent event);
26
    public void pointFixed(MeasureEvent event) throws BehaviorException;
26 27

  
27 28
    /**
28 29
     * Invocado cuando el usuario hace doble click
......
30 31
     *
31 32
     * @param event DOCUMENT ME!
32 33
     */
33
    public void polylineFinished(MeasureEvent event);
34
    public void polylineFinished(MeasureEvent event) throws BehaviorException;
34 35
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Listeners/RectangleListener.java
1 1
package com.iver.cit.gvsig.fmap.tools.Listeners;
2 2

  
3 3
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
4
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
4 5
import com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent;
5 6

  
6 7
/**
......
15 16
     * @param event DOCUMENT ME!
16 17
     * @throws DriverIOException
17 18
     */
18
    public void rectangle(RectangleEvent event) throws Exception;
19
    public void rectangle(RectangleEvent event)  throws BehaviorException;
19 20
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/BehaviorException.java
1
package com.iver.cit.gvsig.fmap.tools;
2

  
3

  
4
public class BehaviorException extends Exception {
5
	/**
6
	 * @param message
7
	 */
8
	public BehaviorException(String message) {
9
		super(message);
10

  
11
	}
12

  
13
	/**
14
	 * @param message
15
	 * @param cause
16
	 */
17
	public BehaviorException(String message, Throwable cause) {
18
		super(message, cause);
19

  
20
	}
21

  
22
}
0 23

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/FMap.java
36 36
import com.iver.cit.gvsig.fmap.operations.selection.Record;
37 37
import com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor;
38 38
import com.iver.cit.gvsig.fmap.operations.strategies.QueryByPointVisitor;
39
import com.iver.cit.gvsig.fmap.operations.strategies.SelectByPointVisitor;
39 40
import com.iver.cit.gvsig.fmap.operations.strategies.SelectByRectVisitor;
40 41
import com.iver.cit.gvsig.fmap.rendering.LegendChangedEvent;
41 42
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
......
303 304
		QueriedPoint qp = new QueriedPoint(p.getX(), p.getY());
304 305
		Point2D mapPoint = viewPort.toMapPoint((int) p.getX(), (int) p.getY());
305 306
		qp.setRealCoords(mapPoint.getX(), mapPoint.getY());
306
		QueryByPointVisitor visitor = new QueryByPointVisitor();
307
		SelectByPointVisitor visitor = new SelectByPointVisitor();
307 308
		visitor.setQueriedPoint(qp);
309
		visitor.setTolerance(getViewPort().toMapDistance(3));
308 310
		layers.process(visitor);
309 311
	}
310 312

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/NewMapControl.java
3 3
import com.hardcode.driverManager.DriverLoadException;
4 4
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
5 5
import com.iver.cit.gvsig.fmap.operations.Cancellable;
6
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
6 7
import com.iver.cit.gvsig.fmap.tools.Behavior.MapTool;
7 8
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
8 9

  
......
364 365
                    repaint();
365 366
                }
366 367
			} catch (DriverException e) {
367
				// TODO Auto-generated catch block
368
				e.printStackTrace();
368
				throwException(e);
369 369
			} finally {
370 370
            }
371 371
        }
......
410 410
		public void mouseClicked(MouseEvent e) {
411 411
			try{
412 412
				currentMapTool.mouseClicked(e);
413
			}catch(Throwable t){
413
			}catch(BehaviorException t){
414 414
				throwException(t);
415 415
			}
416 416
		}
......
421 421
		public void mouseEntered(MouseEvent e) {
422 422
			try{
423 423
				currentMapTool.mouseEntered(e);
424
			}catch(Throwable t){
424
			}catch(BehaviorException t){
425 425
				throwException(t);
426 426
			}
427 427
		}
......
432 432
		public void mouseExited(MouseEvent e) {
433 433
			try{
434 434
				currentMapTool.mouseExited(e);
435
			}catch(Throwable t){
435
			}catch(BehaviorException t){
436 436
				throwException(t);
437 437
			}
438 438
		}
......
443 443
		public void mousePressed(MouseEvent e) {
444 444
			try{
445 445
				currentMapTool.mousePressed(e);
446
			}catch(Throwable t){
446
			}catch(BehaviorException t){
447 447
				throwException(t);
448 448
			}
449 449
		}
......
454 454
		public void mouseReleased(MouseEvent e) {
455 455
			try{
456 456
				currentMapTool.mouseReleased(e);
457
			}catch(Throwable t){
457
			}catch(BehaviorException t){
458 458
				throwException(t);
459 459
			}
460 460
		}
......
465 465
		public void mouseWheelMoved(MouseWheelEvent e) {
466 466
			try{
467 467
				currentMapTool.mouseWheelMoved(e);
468
			}catch(Throwable t){
468
			}catch(BehaviorException t){
469 469
				throwException(t);
470 470
			}
471 471
		}
......
476 476
		public void mouseDragged(MouseEvent e) {
477 477
			try{
478 478
				currentMapTool.mouseDragged(e);
479
			}catch(Throwable t){
479
			}catch(BehaviorException t){
480 480
				throwException(t);
481 481
			}
482 482
		}
......
487 487
		public void mouseMoved(MouseEvent e) {
488 488
			try{
489 489
				currentMapTool.mouseMoved(e);
490
			}catch(Throwable t){
490
			}catch(BehaviorException t){
491 491
				throwException(t);
492 492
			}
493 493
		}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/DemoSHPDriver.java
4 4
import java.awt.geom.Rectangle2D;
5 5
import java.io.File;
6 6
import java.io.FileInputStream;
7
import java.io.FileNotFoundException;
7 8
import java.io.IOException;
8 9
import java.nio.ByteBuffer;
9 10
import java.nio.ByteOrder;
10 11
import java.nio.channels.FileChannel;
11 12

  
13
import com.iver.cit.gvsig.fmap.DriverException;
12 14
import com.iver.cit.gvsig.fmap.core.FShape;
13 15
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
14 16
import com.iver.cit.gvsig.fmap.core.IGeometry;
15 17
import com.iver.cit.gvsig.fmap.core.ShapeFactory;
16 18
import com.iver.cit.gvsig.fmap.drivers.BoundedShapes;
19
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
17 20
import com.iver.cit.gvsig.fmap.drivers.ExternalData;
18 21
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
19 22

  
......
465 468
    }
466 469

  
467 470
    /**
471
     * @throws IOException
472
     * @throws DriverException
468 473
     * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#initialize()
469 474
     */
470
    public void initialize() {
471
        try {
475
    public void initialize() throws IOException{
472 476
            // create a new header.
473 477
            ShapeFileHeader myHeader = new ShapeFileHeader();
474 478

  
......
537 541
                // update the current length the 4 is for the index, and content length.
538 542
                tempCurrentLength = tempCurrentLength + 4 + tempContentLength;
539 543
            }
540
        } catch (Exception e) {
541
            e.printStackTrace();
542
        }
543 544
    }
544 545

  
545 546
    /**

Also available in: Unified diff