Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] New user of using Udig

To do what you want you can create a "Startup" extension.  I think it is org.eclipse.core.startup.  Or something like that.  It requires you to implement a simple interface.  In that interface you will need to check the catalog for your "Globe" shapefile and add it if its not there.  Then you need to open a map.

1.  ApplicationGIS.getProjects() to get all the projects (there's often just one and in your case almost for sure).
2.  projects.iterator().next().getElements(IMap.class) to get a list of all the maps.  Search for the map you've created.  Maybe base search on name
3.  I'm going to assume if your map isn't created then the resource is not in the catalog so lets create a resource for your shapefile
services = CatalogPlugin.getDefault().getServiceFactory().acquire( new URL("file://path to my shapefile" ) );
4.  CatalogPlugin.getDefault().getCatalog().addService( services.iterator().next() );  Add services to catalog.
5.  map = ApplicationGIS.addLayerToMap( null, services.iterator().next().resources( ProgressManager.instance().get() ).iterator().next() );
6.  map.setName( "Name to identify map" );

Done.  

There are lots of useful code snippets at:


Cheers,

Jesse

On 25-Feb-07, at 8:57 PM, Ellis Yu wrote:


Dear All,

        I'm newbie starting to use Udig. I would like to write a program as below link by Eclipse RCP. Just like a map view, it will automatically load my globe shapefile when it start the program, and allow me to do some zoom in and zoom out. Anyone can kindly give me some hint or sample code to me for starting my program. many thanks.

Best Rdgs
Ellis

http://www.mapwindow.org/mapwingis.php


<mime-attachment.gif>



<mime-attachment.gif>
_______________________________________________
User-friendly Desktop Internet GIS (uDig)


Back to the top