Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Adding images

Take a look at:

http://gtsvn.refractions.net/udig/trunk/tutorials/ net.refractions.udig.code.examples/src/net/refractions/udig/code/ examples/CreateAndAddGeoResourceToMap.java

for an example of how to create a resource and add it to the map.

Jesse

On 22-Nov-06, at 8:55 AM, CIP-Students RIU wrote:

ok, I tried with that...thanks

-----Original Message-----
From: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx
[mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx]On Behalf Of Cory
Horner
Sent: Wednesday, November 22, 2006 11:52 AM
To: User-friendly Desktop Internet GIS
Subject: Re: [udig-devel] Adding images


CIP-Students RIU wrote:

Hi Cory, I need add the image not in the Application, else by code, it's mean that I'm programming an Application based in Udig, and I have images(maps) that I need georeference its, I have created the world file, but I don't know add the image in the map...thanks


Okay, here are the steps as I know them:

- Create an IGeoResource from your image
- Create a Layer from your IGeoResource
- Add the Layer to the Map

I will let Jesse explain how to create the IGeoResource -- ultimately
you want an instance of WorldImageGeoResourceImpl, but this is an
internal class, so there would be a better way to obtain it...

As for the last steps:

Create a layer from the IGeoResource:
IGeoResource pngGeoResource;
ILayer layer = pngGeoResource.resolve(ILayer.class, null);

Obtain the map:
ApplicationGIS.getProjects().get(0).getElements(IMap.class).get(0)

http://udig.refractions.net/confluence/display/DEV/How+can+I+find +what+maps+and+projects+are+currently+available%3F

To add the layer to the map:
map.sendCommandASync(new AddLayerCommand(layer) );

http://udig.refractions.net/confluence/display/DEV/How+do+I+add+a +layer+progammatically%3F

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



Back to the top