svn-gvsig-desktop / tags / v1_0_RELEASE / libraries / libFMap / src / com / iver / cit / gvsig / fmap / demo / MapImage.java @ 9167
History | View | Annotate | Download (3.52 KB)
1 | 1218 | fernando | /*
|
---|---|---|---|
2 | * Created on 26-ene-2005
|
||
3 | *
|
||
4 | * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
5 | *
|
||
6 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
7 | *
|
||
8 | * This program is free software; you can redistribute it and/or
|
||
9 | * modify it under the terms of the GNU General Public License
|
||
10 | * as published by the Free Software Foundation; either version 2
|
||
11 | * of the License, or (at your option) any later version.
|
||
12 | *
|
||
13 | * This program is distributed in the hope that it will be useful,
|
||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
16 | * GNU General Public License for more details.
|
||
17 | *
|
||
18 | * You should have received a copy of the GNU General Public License
|
||
19 | * along with this program; if not, write to the Free Software
|
||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||
21 | USA.
|
||
22 | *
|
||
23 | * For more information, contact:
|
||
24 | *
|
||
25 | * Generalitat Valenciana
|
||
26 | * Conselleria d'Infraestructures i Transport
|
||
27 | * Av. Blasco Ib??ez, 50
|
||
28 | * 46010 VALENCIA
|
||
29 | * SPAIN
|
||
30 | *
|
||
31 | * +34 963862235
|
||
32 | * gvsig@gva.es
|
||
33 | * www.gvsig.gva.es
|
||
34 | *
|
||
35 | * or
|
||
36 | *
|
||
37 | * IVER T.I. S.A
|
||
38 | * Salamanca 50
|
||
39 | * 46005 Valencia
|
||
40 | * Spain
|
||
41 | *
|
||
42 | * +34 963163400
|
||
43 | * dac@iver.es
|
||
44 | */
|
||
45 | package com.iver.cit.gvsig.fmap.demo; |
||
46 | |||
47 | import java.io.File; |
||
48 | |||
49 | import javax.swing.JFrame; |
||
50 | |||
51 | 1828 | fernando | import com.hardcode.driverManager.DriverLoadException; |
52 | 1218 | fernando | import com.iver.cit.gvsig.fmap.DriverException; |
53 | 1223 | fernando | import com.iver.cit.gvsig.fmap.MapControl; |
54 | 6164 | luisw2 | import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
55 | 1828 | fernando | import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
56 | 1218 | fernando | import com.iver.cit.gvsig.fmap.layers.FLayer; |
57 | import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
||
58 | import com.iver.cit.gvsig.fmap.tools.ZoomInListenerImpl; |
||
59 | 1221 | fernando | import com.iver.cit.gvsig.fmap.tools.Behavior.RectangleBehavior; |
60 | 1218 | fernando | public class MapImage extends JFrame { |
61 | |||
62 | private javax.swing.JPanel jContentPane = null; |
||
63 | |||
64 | 1223 | fernando | private MapControl newMapControl = null; |
65 | 1218 | fernando | /**
|
66 | * This is the default constructor
|
||
67 | */
|
||
68 | public MapImage() {
|
||
69 | super();
|
||
70 | initialize(); |
||
71 | } |
||
72 | /**
|
||
73 | * This method initializes this
|
||
74 | *
|
||
75 | * @return void
|
||
76 | */
|
||
77 | private void initialize() { |
||
78 | this.setSize(300,200); |
||
79 | this.setContentPane(getJContentPane());
|
||
80 | this.setTitle("JFrame"); |
||
81 | } |
||
82 | /**
|
||
83 | * This method initializes jContentPane
|
||
84 | *
|
||
85 | * @return javax.swing.JPanel
|
||
86 | */
|
||
87 | private javax.swing.JPanel getJContentPane() {
|
||
88 | if(jContentPane == null) { |
||
89 | jContentPane = new javax.swing.JPanel();
|
||
90 | jContentPane.setLayout(new java.awt.BorderLayout());
|
||
91 | jContentPane.add(getNewMapControl(), java.awt.BorderLayout.CENTER); |
||
92 | } |
||
93 | return jContentPane;
|
||
94 | } |
||
95 | /**
|
||
96 | * This method initializes newMapControl
|
||
97 | *
|
||
98 | * @return com.iver.cit.gvsig.fmap.NewMapControl
|
||
99 | */
|
||
100 | 1223 | fernando | private MapControl getNewMapControl() {
|
101 | 1218 | fernando | if (newMapControl == null) { |
102 | 1223 | fernando | newMapControl = new MapControl();
|
103 | 1218 | fernando | LayerFactory.setDriversPath( |
104 | "C:\\eclipse3\\workspace\\Andami\\gvSIG\\extensiones\\com.iver.cit.gvsig\\drivers");
|
||
105 | |||
106 | try {
|
||
107 | 1828 | fernando | FLayer l = LayerFactory.createLayer("Vias",
|
108 | (VectorialFileDriver) LayerFactory.getDM().getDriver("gvSIG shp driver"),
|
||
109 | 1218 | fernando | new File("C:/Documents and Settings/fernando/Mis documentos/vias.shp"), |
110 | 6164 | luisw2 | CRSFactory.getCRS("EPSG:23030"));
|
111 | 1218 | fernando | newMapControl.getMapContext().getLayers().addLayer(l); |
112 | 1221 | fernando | newMapControl.addMapTool("zoom", new RectangleBehavior(new ZoomInListenerImpl(newMapControl))); |
113 | 1218 | fernando | newMapControl.setTool("zoom");
|
114 | 8765 | jjdelcerro | }/* azabala -modificaciones en layerfactory-
|
115 | catch (DriverException e) {
|
||
116 | 1218 | fernando | e.printStackTrace();
|
117 | 8765 | jjdelcerro | } */
|
118 | catch (DriverLoadException e) {
|
||
119 | 1828 | fernando | e.printStackTrace(); |
120 | 1218 | fernando | } |
121 | |||
122 | |||
123 | } |
||
124 | return newMapControl;
|
||
125 | } |
||
126 | } |