[udig-devel] Adding a JPG/JGW in an opened map...

Jesse Eichar jeichar at refractions.net
Thu Jun 22 10:02:18 PDT 2006


Heres a code snippet that should help:

IMap map=ApplicationGIS.getActiveMap();
List<IService> services =CatalogPlugin.getDefault().getServiceFactory 
().acquire(url);
IGeoResource resource = services.get(0).members(null).get(0);
ILayer layer=map.getLayerFactory.createLayer( resource );
MapCommand command=new AddLayerCommand(layer);
map.sendAsync(command);

Jesse

On 22-Jun-06, at 2:11 AM, wouaco at free.fr wrote:

> Hi,
> I am creating a plugin making possible to open an image (and then  
> to create a
> world file, like a jgw for example).
> This plugin should import scanned map, then with scale, scan  
> resolution, and a
> reference point (users can click on a point on the image of which  
> they know gps
> or utm coordinate) , i create the world file...
>
> I have the code to open and create a map of this image, but i want  
> to be able to
> add an image to the current opened map, in a way to have some  
> 'stuck' scanned
> image in one Map...
>
> My code is :
>
> URL url = new URL("file:///"+imageFilePath);
> 				List<IService> services =
> CatalogPlugin.getDefault().getServiceFactory().acquire(url);
> 				IGeoResource resource = services.get(0).members(null).get(0);
> 				ApplicationGIS.createAndOpenMap(Collections.singletonList 
> (resource));
>
> What is the code to do what i want please ?
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel



More information about the udig-devel mailing list