private void makeGraphVisible( IMap map ) throws IOException {
ILayer graphLayer = null;
ILayer pathLayer = null;
ID GRAPH_ID = new ID(new URL( null, GraphMapGraphic.ID, CorePlugin.RELAXED_HANDLER ));
ID PATH_ID = new ID(new URL( null, PathMapGraphic.ID, CorePlugin.RELAXED_HANDLER ));
for( ILayer look : map.getMapLayers() ){
URL id = look.getGeoResource().getIdentifier();
if(GRAPH_ID.equals(id) ){
graphLayer = look;
break;
}
}
if( graphLayer == null ){
ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
IGeoResource resource = catalog.getById(IGeoResource.class, GRAPH_ID, new NullProgressMonitor() );
if( resource == null ){
return; // not available?
}
List<IGeoResource> resourceList = Collections.singletonList( resource );
List< ? extends ILayer> added = ApplicationGIS.addLayersToMap(map, resourceList, 0 );
if( added.isEmpty() ){
return; // not available?
}
graphLayer = (ILayer) added.get(0);
}
if( !graphLayer.isVisible() ){
map.sendCommandASync( new SetLayerVisibilityCommand(graphLayer, true) );
}
for( ILayer look : map.getMapLayers() ){
URL id = look.getGeoResource().getIdentifier();
if(PATH_ID.equals(id) ){
pathLayer = look;
break;
}
}
if( pathLayer == null ){