[Gvsig_desarrolladores] Añadir una capa por codigo

agirrearri agirrearri en hotmail.com
Mar Jun 22 15:10:36 CEST 2010


No se mucho pero el tema del driver cambia, yo te pongo aqui mi código a ver
si te sirve de ayuda.
public class CapaDesdePostGis {

	private FLayer capa;

	CapaDesdePostGis(String server_ip, int server_port, String server_user,
			String server_paswd, String server_schema, String server_dbname,
			String table) {
		
		DataManager manager;
		DataStoreParameters params;
		
		if (server_dbname != null && server_ip != null
				&& server_paswd != null && server_schema != null
				&& server_user != null && table != null) {
			manager = DALLocator.getDataManager();
			try {
				params = manager.createStoreParameters("PostgreSQL");
				params.setDynValue("host", server_ip);
				params.setDynValue("port", server_port);
				params.setDynValue("dbuser", server_user);
				params.setDynValue("password", server_paswd);
				params.setDynValue("schema", server_schema);
				params.setDynValue("dbname", server_dbname);
				params.setDynValue("table", table);
				LayerFactory fabricaDeCapa1 = LayerFactory.getInstance();
				capa = fabricaDeCapa1.createLayer((String) params
						.getDynValue("table"), params);
			} catch (InitializeException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (ProviderNotRegisteredException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (DynFieldNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (LoadLayerException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} else {
		
JOptionPane.showMessageDialog((Component)PluginServices.getMDIManager().getActiveWindow(),
"falta_parametros");
		}
	}


Atentamente eñaut.
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/A-adir-una-capa-por-codigo-tp5208315p5208676.html
Sent from the gvSIG desarrolladores mailing list archive at Nabble.com.


Más información sobre la lista de distribución gvSIG_desarrolladores