Revision 2183 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/DEMO/PruebasGT2.java

View differences:

PruebasGT2.java
51 51
import java.sql.Connection;
52 52
import java.sql.DriverManager;
53 53
import java.sql.SQLException;
54
import java.util.HashMap;
55 54
import java.util.Map;
56 55

  
57 56
import javax.swing.JOptionPane;
......
59 58
import org.geotools.data.DataSourceException;
60 59
import org.geotools.data.DataStore;
61 60
import org.geotools.data.FeatureSource;
62
import org.geotools.data.postgis.PostgisDataStoreFactory;
63 61
import org.geotools.map.DefaultMapLayer;
64 62
import org.geotools.map.MapLayer;
65 63
import org.geotools.styling.Style;
66 64
import org.geotools.styling.StyleBuilder;
67 65

  
68 66
import com.iver.cit.gvsig.fmap.FMap;
69
import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver;
70
import com.iver.cit.gvsig.fmap.drivers.jdbc.mysql.MySQLdriver;
67
import com.iver.cit.gvsig.fmap.drivers.arcsde.ArcSdeDriver;
68
import com.iver.cit.gvsig.fmap.drivers.jdbc.mysql.MySQLDriver;
71 69
import com.iver.cit.gvsig.fmap.drivers.jdbc.postgis.PostGisDriver;
72 70
import com.iver.cit.gvsig.fmap.layers.CancelationException;
73 71
import com.iver.cit.gvsig.fmap.layers.FLayer;
......
84 82
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
85 83
 */
86 84
public class PruebasGT2 implements ActionListener {
87
    static PostgisDataStoreFactory postGisFactory = new PostgisDataStoreFactory();
85
    // static PostgisDataStoreFactory postGisFactory = new PostgisDataStoreFactory();
88 86
    // static ArcSDEDataStoreFactory arcSdeFactory = new ArcSDEDataStoreFactory();
89 87

  
90 88
    Map remote;
......
123 121
   protected void addLayer_PostGIS()
124 122
   {
125 123
       String nomTabla = JOptionPane.showInputDialog(null, "?Nombre de la tabla a cargar?", "provin");
126
       VectorialDatabaseDriver driver = new PostGisDriver();
124
       PostGisDriver driver = new PostGisDriver();
127 125
       String dburl = "jdbc:postgresql://localhost/latin1";
128 126
       String dbuser = "postgres";
129 127
       String dbpass = "aquilina";
......
148 146
    }
149 147
        
150 148
   }
149
   protected void addLayer_ArcSDE_propio()
150
   {       
151
       String nomTabla = "vias"; //JOptionPane.showInputDialog(null, "?Nombre de la tabla a cargar?", "vias");
152
       ArcSdeDriver driver = new ArcSdeDriver();
153
       String dbHost = "Alvaro";
154
       String dbuser = "sde";
155
       String dbpass = "sde";
156
       // String[] fields = {"Shape", "NOM_PROVIN"};
157
       String[] fields = null; //{"Shape", "RD_5", "RD_11"};
158
       int instance      = 5151;
159
       String database   = "sigespa";
160
       
161
       String whereClause = "";
162
       
163
       
164
        driver.setData(dbHost, instance, database, dbuser, dbpass, nomTabla, fields, whereClause);
165
        FLayer lyr = LayerFactory.createArcSDELayer(nomTabla, driver, null);
166
        m_Mapa.getLayers().addLayer(lyr);
167
        
168
   }
169
   
151 170
   protected void addLayer_mySQL()
152 171
   {
153 172
       String nomTabla = JOptionPane.showInputDialog(null, "?Nombre de la tabla a cargar?", "provin");
154
       VectorialDatabaseDriver driver = new MySQLdriver();
173
       MySQLDriver driver = new MySQLDriver();
155 174
       String dburl = "jdbc:mysql://localhost/test";
156 175
       String dbuser = "root";
157 176
       String dbpass = "aquilina";
......
182 201
   
183 202
   protected void addLayerGT2_PostGIS()
184 203
   {
185
       String nomTabla = JOptionPane.showInputDialog(null, "?Nombre de la tabla a cargar?", "provin");
204
       /* String nomTabla = JOptionPane.showInputDialog(null, "?Nombre de la tabla a cargar?", "provin");
186 205
       
187 206
	    remote = new HashMap();
188 207
	    remote.put("dbtype","postgis");        
......
202 221
		} catch (IOException e) {
203 222
			// TODO Auto-generated catch block
204 223
			e.printStackTrace();
205
		} 
224
		} */
206 225
   }
207 226

  
208 227
   
......
253 272
   
254 273
   protected void addLayerGT2_ArcSDE()
255 274
   {
256
	    remote = new HashMap();
275
	    /* remote = new HashMap();
257 276
	    remote.put("dbtype","arcsde");        
258
	    remote.put("server","192.168.0.165"); //Jos? Miguel
277
	    remote.put("server","Alvaro"); //Jos? Miguel
259 278
	    remote.put("port", new Integer(5151));
260
	    remote.put("instance", "sde");
279
	    remote.put("instance", "sigespa");
261 280
	    remote.put("user", "sde");
262
	    remote.put("password", "aquilina");
281
	    remote.put("password", "sde");
263 282
	    
264 283
	    
265 284
	    DataStore store;
266
		/* try {
285
		try {
267 286
			store = arcSdeFactory.createDataStore(remote);
268 287
			loadLayer(store, "SDE.VIAS");
269 288
			
......
287 306
		if (e.getActionCommand() == "ADD_GT2_MYSQL_PROPIO") {            
288 307
			addLayer_mySQL();
289 308
		}
309
        if (e.getActionCommand() == "ADD_GT2_ARCSDE_PROPIO") {            
310
            addLayer_ArcSDE_propio();
311
        }
290 312

  
291 313
		if (e.getActionCommand() == "ADD_GT2_POSTGIS") {            
292 314
			addLayerGT2_PostGIS();

Also available in: Unified diff