Peppe, try to fetch the layerloader from the Registry like OpenFileWizard does.
Registry registry = workbenchContext.getRegistry(); List<FileLayerLoader> loaders = registry.getEntries(FileLayerLoader.KEY); FileLayerLoader loader = null; for (FileLayerLoader fileLayerLoader : loaders) { if (fileLayerLoader instanceof GeoImageFactoryFileLayerLoader) loader = fileLayerLoader; } loader.open(TaskMonitor monitor, URI uri, Map<String, Object> options); that's just written down, not compile tested. the open method does everything for you. layer creation and filling it. ..ede On 24.11.2017 12:30, Giuseppe Aruta wrote: > Hi Ede, > thanks for the suggestion. > I can see the method ReferencedImageFactoryFileLayerLoader.open(..) is a > boolen > How can I use it? > > < I tried: > String inputFile ="D:/test.tif"; > String category= StandardCategoryNames.WORKING > URI uri = inputFile .toURI(); > ReferencedImageFactoryFileLayerLoader loader = null; > Layer layer = loader.createLayer(context.getLayerManager(), uri); > context.getLayerManager().addLayer(category, layer); > > but id doesb't work> > > Peppe > > 2017-11-24 11:51 GMT+01:00 <edgar.sol...@web.de <mailto:edgar.sol...@web.de>>: > > Peppe, > > you should probably use > > com.vividsolutions.jump.workbench.imagery.ReferencedImageFactoryFileLayerLoader.open(...) > as it is done in > org.openjump.core.ui.plugin.file.open.OpenFileWizard.run(...) L#156ff > > you can give a target layername via the options map. > > ..ede > > > On 24.11.2017 11:16, Giuseppe Aruta wrote: > > Greetings > > I am able to programmatically load a tif image as RasterImageLayer via > plugin, > > Two years ago I added a class > (org.openjump.core.rasterimage.RasterImageIOUtils) > > To make the process easier. For instance, related to my question, the > method: > > RasterImageIOUtils.loadTIF(File file, PlugInContext context, String > category). > > > > I can write on my plugin these simple lines: > > > > String inputFile ="D:/test.tif"; > > String category= StandardCategoryNames.WORKING; > > RasterImageIOUtils.loadTIF(inputFile, context, category) > > > > and the file is loaded into the view > > > > The class org.openjump.core.apitools.IOTools have methods for vectors > (Shapefiles and JML). > > This class is used by Sextante toolbox to load/save vector files > > > > My question is if we have something similar to load a Tif image as > Layer (RefrenceImageLayer). > > If not, how can I load a tif image as Layer (RefrenceImageLayer) via > PlugIn? > > > > thanks in advance > > Peppe > > > > > > > ------------------------------------------------------------------------------ > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > > > > > _______________________________________________ > > Jump-pilot-devel mailing list > > Jump-pilot-devel@lists.sourceforge.net > <mailto:Jump-pilot-devel@lists.sourceforge.net> > > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > <https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel> > > > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > <mailto:Jump-pilot-devel@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > <https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel> > > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel