[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [udig-devel] MapGraphics and Layer
|
Hey Andy,
I'm afraid I'm in Atlanta this week and super busy so I won't be able to
directly debug this. But here are some things you can check for.
1. In the Layer>Other... menu item (this is for adding non-default mapgraphics
from the UI) do you see your mapGraphic?
2. Make sure your map graphic plugin has all of its dependencies... I just
recent learned that there are some transitive dependencies that can occur that
will disable plugins that have the dependency. I don't know very much about
this yet as I've just learned about it this morning. But when you run click the
validate plugins button in the run configuration dialog.
3. I added the requirement for an ID in the map graphic extension definition
and also now use the name and icon defined there. If you don't have an id
defined you may have a problem. While the name and icon are not required the
functionality that uses them is very new and may have problems if there is not a
name and icon defined. so add something there to see if that helps
That's all I can think of off the top of my head.
Good luck and I'll help as soon as I can,
Jesse
Quoting Andy Czerwonka <czerwonka@xxxxxxxxxxxxxxxx>:
> In one of the more recent 1.1.x releases, my code broke. I'm creating a
> layer with a MapGraphic, but now I'm not able to create that layer. The
> code looks like this... (it falls out on the assert about halfway down)
>
> public void createGpsLayer() {
> Map map = ApplicationGISInternal.getActiveMap();
>
> try {
> IGeoResource gpsDataResource = null;
> URL url = new URL(MapGraphicService.SERVICE_URL, "#" +
> GpsMapGraphic.ID); //$NON-NLS-1$
> List<IResolve> matches =
> CatalogPlugin.getDefault().getLocalCatalog().find(url,
> new NullProgressMonitor());
> if (!matches.isEmpty())
> gpsDataResource = (IGeoResource) matches.get(0);
> if (gpsDataResource == null) {
> List<IService> results =
> CatalogPlugin.getDefault().getServiceFactory()
> .acquire(url);
> for (IGeoResource resource : results.get(0).members(new
> NullProgressMonitor())) {
> if
> (resource.getIdentifier().getRef().equals(url.getRef())) {
> gpsDataResource = resource;
> break;
> }
> }
> }
> assert null != gpsDataResource : "Somethig is wrong" // it falls
> our here...
> _gpsLayer = map.getLayerFactory().createLayer(gpsDataResource);
> _gpsLayer.setName(LAYER_NAME);
> _gpsLayer.setSelectable(true);
> int top = map.getMapLayers().size();
>
> map.sendCommandSync(BasicCommandFactory.getInstance().createAddLayer
(_gpsLayer,
> top));
> _mapGraphic = _gpsLayer.getResource(GpsMapGraphic.class, null);
>
> Activator.getDefault().getModel().addEventCollectionListener(_mapGraphic);
> startRefresher();
> } catch (MalformedURLException e) {
> AppLogger.log(e);
> } catch (IOException e) {
> AppLogger.log(e);
> }
>
> }
>
> Help appreciated...
>
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>