Hi again.

Does udig have any standard way to load maps on application startup?

I using map viewer and currently i load defaul map like this

private void addLayer(){
         List<IGeoResource> dataHandles = new ArrayList<IGeoResource>();
         ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
         IServiceFactory factory = 
CatalogPlugin.getDefault().getServiceFactory();
             try {
                 File file = new File(path);
                 URL url = file.toURI().toURL();
                 IService handle = catalog.acquire(url, null);
                 if (handle != null) {
                     List<IGeoResource> resources = (List<IGeoResource>) handle
                             .resources(new NullProgressMonitor());
                     dataHandles.addAll(resources);
                 }
             } catch (IOException eek) {
                 String message = "Could not add " + path;
                 IStatus status = new Status(IStatus.WARNING, 
Activator.PLUGIN_ID, message, eek);
                 Activator.getDefault().getLog().log(status);
             }
             
             map.sendCommandASync(new AddLayersCommand(dataHandles));
    }

And i'll call this method right after 

map = (Map) ProjectFactory.eINSTANCE.createMap(); On the ViewPart 
creatPartControl();


What i mean is this a right way to add new layer on application startup?


- Kokkonen
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to