[Gvsig_english] load layer by code
Jorge Piera Llodrá
jpiera at prodevelop.es
Wed Jan 12 07:51:04 CET 2011
Hi.
I suppose that you are loading this layer from a extension that is
installed in a gvSIG that is able to load the shape using the user
interface. Is it right?
Regards,
Jorge
On 01/11/2011 10:20 PM, Claudio wrote:
> 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
>
>
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at listserv.gva.es
> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>
--
Jorge Piera Llodrá
gvSIG Development Team
PRODEVELOP
Plaza Don Juan de Villarrasa, 14 - 5
46001 Valencia
Tel: +34 963510612
Fax: +34 963510908
e-mail: jpiera at prodevelop.es
http://www.prodevelop.es
http://www.gvsig.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20110112/3e5c78f6/attachment.htm
More information about the Gvsig_internacional
mailing list