Revision 230 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/demo/ImageFrame.java
ImageFrame.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.fmap.demo; |
2 | 2 |
|
3 |
import java.io.File; |
|
4 |
|
|
3 | 5 |
import javax.swing.JFrame; |
4 | 6 |
import javax.swing.JPanel; |
5 | 7 |
|
8 |
import com.iver.cit.gvsig.fmap.NewMapControl; |
|
6 | 9 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
10 |
import com.iver.cit.gvsig.fmap.drivers.shp.DemoSHPDriver; |
|
11 |
import com.iver.cit.gvsig.fmap.layers.ChildrenNotAllowedException; |
|
12 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
|
13 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
|
14 |
import com.iver.cit.gvsig.fmap.layers.LayerPath; |
|
15 |
import com.iver.cit.gvsig.fmap.layers.ProjectionMismatchException; |
|
16 |
import com.iver.cit.gvsig.fmap.tools.ZoomMasMapTool; |
|
7 | 17 |
public class ImageFrame extends JFrame { |
8 | 18 |
|
9 | 19 |
private javax.swing.JPanel jContentPane = null; |
... | ... | |
40 | 50 |
return jContentPane; |
41 | 51 |
} |
42 | 52 |
|
43 |
private ImageControl jPanel = null;
|
|
53 |
private NewMapControl jPanel = null;
|
|
44 | 54 |
/** |
45 | 55 |
* This method initializes jPanel |
46 | 56 |
* |
47 | 57 |
* @return javax.swing.JPanel |
48 | 58 |
*/ |
49 |
private JPanel getJPanel() {
|
|
59 |
private NewMapControl getJPanel() {
|
|
50 | 60 |
if (jPanel == null) { |
51 | 61 |
try { |
52 |
jPanel = new ImageControl(); |
|
62 |
jPanel = new NewMapControl(); |
|
63 |
DemoSHPDriver driver = new DemoSHPDriver(); |
|
64 |
FLyrVect l = LayerFactory.createLayer(driver, new File("C:\\Documents and Settings\\fernando\\Mis documentos\\vias.shp"), null); |
|
65 |
try { |
|
66 |
jPanel.getMapContext().addLayer(new LayerPath(), l); |
|
67 |
l.getSource().start(); |
|
68 |
jPanel.getMapContext().getViewPort().setExtent(l.getFullExtent()); |
|
69 |
l.getSource().stop(); |
|
70 |
jPanel.addMapTool("rectangulo", new ZoomMasMapTool()); |
|
71 |
jPanel.addTool("zoomMas", "rectangulo"); |
|
72 |
jPanel.setTool("zoomMas"); |
|
73 |
} catch (ProjectionMismatchException e) { |
|
74 |
e.printStackTrace(); |
|
75 |
} catch (ChildrenNotAllowedException e) { |
|
76 |
e.printStackTrace(); |
|
77 |
} |
|
78 |
|
|
79 |
|
|
53 | 80 |
} catch (DriverIOException e) { |
54 | 81 |
e.printStackTrace(); |
55 | 82 |
} |
Also available in: Unified diff