Hello,
Maria Neywell wrote:
Thanks Ugo,
I get it, but now how can I display the map in a RCP view which extends
MapPart class.
You are using the rcp tutorial from udig, aren't you? I think this is
such an example.
I used :
mapviewer = *new* MapViewer(parent);
… [your code]
mapviewer.setMap(map);
Furthermore I used your code with some customization to create a “.udig”
project and I noticed when I open this project with uDig the map is
created but doesn’t work, I don’t know if it can help me for debugging
my code and displaying my map in my RCP application.
Have a look at the logs under (...)/workspace/.metadata/.log (or
something like that).
Sorry if I'm not much of a help :-(
Maria
Cheers,
Ugo
Hello Maria,
you'd need to to something like:
String filename = "/home/user/mydata.shp";
File file = new File(filename);
URL url = new URL("file://" + filename);
IServiceFactory serviceFactory =
CatalogPlugin.getDefault().getServiceFactory();
for (IService service : serviceFactory.createService(url)) {
ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
catalog.add(service);
List<? extends IGeoResource> resources = service.resources(new
NullProgressMonitor());
List<ILayer> newLayers =
(List<ILayer>)ApplicationGIS.addLayersToMap(map, resources, 0,
map.getProject(), true);
}
Watch out: copy and paste code. I edited it bit, so you might need
to change a few things. But I thing it's enough to get you going.
(The trick here is to iterate over the service.)
HTH,
Ugo
Maria Neywell wrote:
Hi list,
I’m a newbie in uDig development.
I’m trying to make a little eclipse RCP
application with some uDig functionalities.
First I would like to display a shapefile in a Map View defined
in my RCP application. But I don’t know how to do it
programmatically, I don’t want the user to create his map. My
application has just a view containing my map.
Here is my code :
map = (Map) ProjectFactory./eINSTANCE/.createMap();
mapviewer.setMap(map);
How can I define a map directly with my shapefile ?
Cheer,
Maria
------------------------------------------------------------------------
_______________________________________________
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
------------------------------------------------------------------------
_______________________________________________
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