[Gvsig_desarrolladores] Abrir Vista al inicializar gv Sig

Begoña Gonzalez begodom en gmail.com
Mie Abr 16 16:38:15 CEST 2008


Muchas gracias por tu ayuda. Me ha funcionado perfectamente.

Saludos

2008/4/16 Raul Romero Moreno <rromero en tragsa.es>:

> Espero que esto te ayude. Un saludo.
>
>
> //Crear una vista en un proyecto dado.
>
>        public static ProjectView createView(Project p,String nombre){
>                ProjectView pv= ProjectFactory.createView(null);
>                pv.setName(nombre);
>                p.addDocument((ProjectDocument)pv);
>                return pv;
>        }
>
> //Añadir una capa a una vista codEPSG por ejemplo 23030
>
>        public static FLayer addLayer(View v, File fichShp, String nombre,
> int codEPSG){
>                if (fichShp.exists()){
>
>                        MapControl mapCtrl = v.getMapControl();
>                        System.out.println("Nombre = " + nombre + ", path=
> "+ fichShp.getAbsolutePath());
>                        try {
>                                FLayer l = LayerFactory.createLayer(nombre
> ,
>                                                (VectorialFileDriver)
> LayerFactory.getDM().getDriver("gvSIG shp driver"),
>                                                fichShp,
> CRSFactory.getCRS("EPSG:"+codEPSG));
>
>  mapCtrl.getMapContext().getLayers().addLayer(l);
>                                return l;
>
>                        }
>                        catch (Exception e) {
>                                e.printStackTrace();
>                        }
>                }
>                return null;
>        }
>
> //Abrir una vista dado un proyecto
>
>        public static View ProjectView openView(ProjectView pv, Project
> proj, int codEPSG){
>                MDIManager manejadorMdi=PluginServices.getMDIManager();
>                IProjection proyeccion=CRSFactory.getCRS("EPSG:"+ codEPSG);
>                View nv=new View();
>                nv.initialize();
>                nv.setModel(pv);
>                nv.setProjection(proyeccion);
>                manejadorMdi.addWindow(nv);
>
>                return nv
>        }
>
> **********************************************************************************************
> El consumo de papel es perjudicial para el medio ambiente. Por favor,
> téngalo en cuenta antes de imprimir
> este mensaje.
>
> AVISO LEGAL: Este mensaje y sus anexos pueden contener información
> confidencial o legalmente protegida.
> Está dirigido únicamente a la persona o entidad reseñada como
> destinatarios del mensaje. Si este mensaje le
> hubiera llegado por error, por favor elimínelo sin revisarlo ni reenviarlo
> y notifíquelo inmediatamente al
> remitente.
>
> **********************************************************************************************
>
>
> _______________________________________________
> gvSIG_desarrolladores mailing list
> gvSIG_desarrolladores en runas.cap.gva.es
> http://runas.cap.gva.es/mailman/listinfo/gvsig_desarrolladores
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://runas.cap.gva.es/pipermail/gvsig_desarrolladores/attachments/20080416/e3458c2b/attachment.htm


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