[Gvsig_english] load layer by code

Claudio cla.schifani at gmail.com
Tue Jan 11 22:20:15 CET 2011


Dear list,
I tried to load a simple layer (shape file) by code [1], but it doesn't work...
someone can help me?
this is my extension code for the execute method:

......
public void execute(String actionCommand) {
		// TODO Auto-generated method stub		
try {		
View v = (View) PluginServices.getMDIManager().getActiveWindow();
MapControl mapCtrl = v.getMapControl();
String layerName = actionCommand;
VectorialFileDriver driver = (VectorialFileDriver) LayerFactory.getDM().getDriver("gvSIG shp driver");		
FLayer prova = LayerFactory.createLayer(layerName, driver, new File ("/Users/claudio/prova.shp"), CRSFactory.getCRS("EPSG:3003"));
prova.setVisible(true);
mapCtrl.getMapContext().getLayers().addLayer(prova);
}
catch (DriverLoadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} 		
	}

and this is the eclipse console error message:

ERROR [AWT-EventQueue-1] (BaseException.java:53) - com.hardcode.driverManager.DriverLoadException: formatString is null.
null
	at com.hardcode.driverManager.DriverManager.getDriver(DriverManager.java:170)
........


Thanks a lot for every reply,
Claudio

[1] http://www.gvsig.org/web/docdev/manual-para-desarrolladores-gvsig/librerias-internas/ejemplos-de-uso-de-fmap/anadir-una-capa-por-codigo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20110111/9af062b5/attachment.htm 


More information about the Gvsig_internacional mailing list