Revision 234

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/ViewPort.java
4 4

  
5 5
import java.awt.Color;
6 6
import java.awt.Dimension;
7
import java.awt.Point;
7 8
import java.awt.geom.AffineTransform;
9
import java.awt.geom.NoninvertibleTransformException;
8 10
import java.awt.geom.Point2D;
9 11
import java.awt.geom.Rectangle2D;
10 12
import java.util.ArrayList;
......
41 43
	}
42 44

  
43 45
    public int fromMapDistance(double d) {
44
    	//TODO Implementar bien
45
    	return -1;
46
        Point2D.Double pWorld = new Point2D.Double(1, 1);
47
        Point2D.Double pScreen = new Point2D.Double();
48

  
49
        double nuevoX;
50
        double nuevoY;
51
        double cX;
52
        double cY;
53

  
54
        try {
55
            trans.deltaTransform(pWorld, pScreen);
56
        } catch (Exception e) {
57
            System.err.print(e.getMessage());
58
        }
59

  
60
        return (int) (d * pScreen.x);
46 61
    }
47 62

  
48 63
    public Point2D fromMapPoint(double x, double y) {
49
    	//TODO Implementar bien
50
    	return null;
64
        Point2D.Double pWorld = new Point2D.Double(x, y);
65
        Point2D.Double pScreen = new Point2D.Double();
66

  
67
        double nuevoX;
68
        double nuevoY;
69
        double cX;
70
        double cY;
71

  
72
        try {
73
            trans.transform(pWorld, pScreen);
74
        } catch (Exception e) {
75
            System.err.print(e.getMessage());
76
        }
77

  
78
        return pScreen;
51 79
    }
52 80

  
53 81
    public Point2D toMapPoint(int x, int y) {
54
    	//TODO Implementar bien
55
    	return null;
82
    	Point pScreen = new Point(x, y);
83
    	return toMapPoint(pScreen);
56 84
    }
57 85

  
58 86
    public double toMapDistance(int d) {
......
61 89
    }
62 90

  
63 91
    public Point2D toMapPoint(Point2D pScreen) {
64
    	//TODO Implementar bien
65
    	return null;
92
        Point2D.Double pWorld = new Point2D.Double();
93
        AffineTransform at;
94

  
95
        try {
96
            at = trans.createInverse();
97
            at.transform(pScreen, pWorld);
98
        } catch (NoninvertibleTransformException e) {
99
            throw new RuntimeException(e);
100
        }
101

  
102
        return pWorld;
66 103
    }
67 104

  
68 105
    public void setPreviousExtent() {
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/ZoomMasMapTool.java
135 135

  
136 136
                r.setFrameFromDiagonal(p1, p2);
137 137

  
138
                vp.setExtent(r);
138
                vp.setExtent(r);                                                
139 139
            }
140
            getMapControl().drawMap();
140 141
        }
141 142
	}
142 143

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/demo/ImageFrame.java
61 61
			try {
62 62
				jPanel = new NewMapControl();
63 63
				DemoSHPDriver driver = new DemoSHPDriver();
64
				FLyrVect l = LayerFactory.createLayer(driver, new File("C:\\Documents and Settings\\fernando\\Mis documentos\\vias.shp"), null);
64
				FLyrVect l = LayerFactory.createLayer(driver, new File("D:/fjp/chiara/plano/vias.shp"), null);
65 65
				try {
66 66
					jPanel.getMapContext().addLayer(new LayerPath(), l);
67 67
					l.getSource().start();
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/demo/ImageControl.java
34 34

  
35 35
	public ImageControl() throws DriverIOException{
36 36
		DemoSHPDriver driver = new DemoSHPDriver();
37
		FLyrVect l = LayerFactory.createLayer(driver, new File("C:\\Layers\\multipnt.shp"), null);
37
		FLyrVect l = LayerFactory.createLayer(driver, new File("D:/fjp/chiara/plano/vias.shp"), null);
38 38
		try {
39 39
			fmap.addLayer(new LayerPath(), l);
40 40
		} catch (ProjectionMismatchException e) {

Also available in: Unified diff