Peppe, you reformatted a whole class, which did not have any formatting issues. please refrain from doing that in favour of enabling others spotting your changes.
btw. didn't we negotiate - spaces only - indention is two spaces - reformatting only if the whole file is a big indention mess (tabs/spaces, bigger/smaller indention) that cannot be dealt w/ manually in the past for OJ? ..ede On 28.11.2017 16:01, jump-pilot-svn--- via Jump-pilot-devel wrote: > Revision: 5592 > http://sourceforge.net/p/jump-pilot/code/5592 > Author: ma15569 > Date: 2017-11-28 15:01:34 +0000 (Tue, 28 Nov 2017) > Log Message: > ----------- > Small upgrade WMS URLs > > Modified Paths: > -------------- > core/trunk/src/org/openjump/core/ui/plugin/wms/AddWmsLayerWizard.java > > Modified: > core/trunk/src/org/openjump/core/ui/plugin/wms/AddWmsLayerWizard.java > =================================================================== > --- core/trunk/src/org/openjump/core/ui/plugin/wms/AddWmsLayerWizard.java > 2017-11-28 13:25:04 UTC (rev 5591) > +++ core/trunk/src/org/openjump/core/ui/plugin/wms/AddWmsLayerWizard.java > 2017-11-28 15:01:34 UTC (rev 5592) > @@ -1,5 +1,13 @@ > package org.openjump.core.ui.plugin.wms; > > +import java.io.IOException; > +import java.util.ArrayList; > +import java.util.Collection; > +import java.util.List; > + > +import org.openjump.core.ui.plugin.file.open.ChooseProjectPanel; > +import org.openjump.core.ui.swing.wizard.AbstractWizardGroup; > + > import com.vividsolutions.jump.I18N; > import com.vividsolutions.jump.task.TaskMonitor; > import com.vividsolutions.jump.workbench.WorkbenchContext; > @@ -18,125 +26,136 @@ > import com.vividsolutions.jump.workbench.ui.wizard.WizardDialog; > import com.vividsolutions.wms.MapLayer; > import com.vividsolutions.wms.WMService; > -import org.openjump.core.ui.plugin.file.open.ChooseProjectPanel; > -import org.openjump.core.ui.swing.wizard.AbstractWizardGroup; > > -import java.io.IOException; > -import java.util.ArrayList; > -import java.util.Collection; > -import java.util.List; > - > public class AddWmsLayerWizard extends AbstractWizardGroup { > - > - public static final String CACHED_URL_KEY = "AddWMSQueryPlugin.CACHED_URL"; > > - public static final String KEY = AddWmsLayerWizard.class.getName(); > + public static final String CACHED_URL_KEY = > "AddWMSQueryPlugin.CACHED_URL"; > > - private WorkbenchContext workbenchContext; > + public static final String KEY = AddWmsLayerWizard.class.getName(); > > - public static final String[] DEFAULT_URLS = new String[] { > - "http://deegree3-demo.deegree.org/utah-workspace/services", > - "http://demo.opengeo.org/geoserver/wms", > - //"http://wiki.openstreetmap.org/wiki/WMS", // does not work (missing > WMT_MS_Capabilities) > - //"http://openaerialmap.org/wms/", // does not work (2013-06-09) > - "http://wms.jpl.nasa.gov/wms.cgi", > - //"http://wms.latlon.org/?", // does not work (missing > WMT_MS_Capabilities) > - "http://ows.terrestris.de/osm/service", > - "http://maps.omniscale.net/wms/demo/default/service", > - // addresses added on 2013-06-19 > - "http://www2.demis.nl/WMS/wms.ashx?wms=WorldMap", > - > "http://gridca.grid.unep.ch/cgi-bin/mapserv?map=/www/geodataportal/htdocs/mod_map/geo_wms.map&", > - "http://demo.mapserver.org/cgi-bin/wms", > - > "http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/raster/ortofoto_colore_06.map&", > + private WorkbenchContext workbenchContext; > > - }; > + public static final String[] DEFAULT_URLS = new String[] { > + "http://deegree3-demo.deegree.org/utah-workspace/services", > + "http://demo.opengeo.org/geoserver/wms", > + // "http://wiki.openstreetmap.org/wiki/WMS", // does not work > + // (missing WMT_MS_Capabilities) > + // "http://openaerialmap.org/wms/", // does not work (2013-06-09) > + "http://wms.jpl.nasa.gov/wms.cgi", > + // "http://wms.latlon.org/?", // does not work (missing > + // WMT_MS_Capabilities) > + "http://ows.terrestris.de/osm/service", > + "http://maps.omniscale.net/wms/demo/default/service", > + // addresses added on 2013-06-19 > + "http://www2.demis.nl/WMS/wms.ashx?wms=WorldMap", > + > "http://gridca.grid.unep.ch/cgi-bin/mapserv?map=/www/geodataportal/htdocs/mod_map/geo_wms.map&", > + "http://demo.mapserver.org/cgi-bin/wms", > > - private String lastWMSVersion = WMService.WMS_1_1_1; > + // > "http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/raster/ortofoto_colore_06.map&" > + // //does not work > + > "http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/raster/ortofoto_colore_12.map&service=wms&request=getCapabilities&version=1.3.0&", > + > "https://www.gebco.net/data_and_products/gebco_web_services/web_map_service/mapserv? > ", > + > "https://www.gebco.net/data_and_products/gebco_web_services/north_polar_view_wms/mapserv?", > + > "https://www.gebco.net/data_and_products/gebco_web_services/south_polar_view_wms/mapserv?" > > - private ChooseProjectPanel chooseProjectPanel; > + }; > > - public AddWmsLayerWizard(WorkbenchContext workbenchContext) { > - > super(I18N.get("org.openjump.core.ui.plugin.wms.AddWmsLayerWizard.Add-WMS-Layer"), > IconLoader.icon("globe3_16.png"), > - URLWizardPanel.class.getName()); > - this.workbenchContext = workbenchContext; > - } > + private String lastWMSVersion = WMService.WMS_1_1_1; > > - public void initialize(WorkbenchContext workbenchContext, WizardDialog > dialog) { > - removeAllPanels(); > + private ChooseProjectPanel chooseProjectPanel; > > + public AddWmsLayerWizard(WorkbenchContext workbenchContext) { > + super( > + > I18N.get("org.openjump.core.ui.plugin.wms.AddWmsLayerWizard.Add-WMS-Layer"), > + IconLoader.icon("globe3_16.png"), URLWizardPanel.class > + .getName()); > + this.workbenchContext = workbenchContext; > + } > > - URLWizardPanel urlPanel = URLWizardPanel.getInstance(); > - chooseProjectPanel = new ChooseProjectPanel(workbenchContext, > - urlPanel.getID()); > - addPanel(chooseProjectPanel); > + @Override > + public void initialize(WorkbenchContext workbenchContext, > + WizardDialog dialog) { > + removeAllPanels(); > > - addPanel(urlPanel); > - addPanel(new MapLayerWizardPanel()); > - addPanel(new SRSWizardPanel()); > - addPanel(new OneSRSWizardPanel()); > - } > + URLWizardPanel urlPanel = URLWizardPanel.getInstance(); > + chooseProjectPanel = new ChooseProjectPanel(workbenchContext, > + urlPanel.getID()); > + addPanel(chooseProjectPanel); > > - public String getFirstId() { > - String firstId = super.getFirstId(); > - if (!chooseProjectPanel.hasActiveTaskFrame() > - && chooseProjectPanel.hasTaskFrames()) { > - chooseProjectPanel.setNextID(firstId); > - return chooseProjectPanel.getID(); > - } else { > - return firstId; > + addPanel(urlPanel); > + addPanel(new MapLayerWizardPanel()); > + addPanel(new SRSWizardPanel()); > + addPanel(new OneSRSWizardPanel()); > } > - } > > - public void run(WizardDialog dialog, TaskMonitor monitor) { > - chooseProjectPanel.activateSelectedProject(); > - try { > - PlugInContext context = workbenchContext.createPlugInContext(); > - List<MapLayer> mapLayers = > (List<MapLayer>)dialog.getData(MapLayerWizardPanel.LAYERS_KEY); > - String title = mapLayers.get(0).getTitle(); > - List<String> layerNames = toLayerNames(mapLayers); > + @Override > + public String getFirstId() { > + String firstId = super.getFirstId(); > + if (!chooseProjectPanel.hasActiveTaskFrame() > + && chooseProjectPanel.hasTaskFrames()) { > + chooseProjectPanel.setNextID(firstId); > + return chooseProjectPanel.getID(); > + } else { > + return firstId; > + } > + } > > - WMService service = > (WMService)dialog.getData(URLWizardPanel.SERVICE_KEY); > - String srs = (String)dialog.getData(SRSWizardPanel.SRS_KEY); > - String format = ((String)dialog.getData(URLWizardPanel.FORMAT_KEY)); > - WMSLayer layer = new WMSLayer(title, context.getLayerManager(), > service, > - srs, layerNames, format); > + @Override > + public void run(WizardDialog dialog, TaskMonitor monitor) { > + chooseProjectPanel.activateSelectedProject(); > + try { > + PlugInContext context = workbenchContext.createPlugInContext(); > + List<MapLayer> mapLayers = (List<MapLayer>) dialog > + .getData(MapLayerWizardPanel.LAYERS_KEY); > + String title = mapLayers.get(0).getTitle(); > + List<String> layerNames = toLayerNames(mapLayers); > > - LayerNamePanel layerNamePanel = context.getLayerNamePanel(); > - Collection<Category> selectedCategories = > layerNamePanel.getSelectedCategories(); > - LayerManager mgr = context.getLayerManager(); > - String categoryName = StandardCategoryNames.WORKING; > - if (!selectedCategories.isEmpty()) { > - categoryName = selectedCategories.iterator().next().getName(); > - } > - mgr.addLayerable(categoryName, layer); > - String[] lastURLs = (String[])dialog.getData(URLWizardPanel.URL_KEY); > - lastWMSVersion = (String)dialog.getData(URLWizardPanel.VERSION_KEY); > + WMService service = (WMService) dialog > + .getData(URLWizardPanel.SERVICE_KEY); > + String srs = (String) dialog.getData(SRSWizardPanel.SRS_KEY); > + String format = ((String) > dialog.getData(URLWizardPanel.FORMAT_KEY)); > + WMSLayer layer = new WMSLayer(title, context.getLayerManager(), > + service, srs, layerNames, format); > > - PersistentBlackboardPlugIn.get(context.getWorkbenchContext()).put( > - CACHED_URL_KEY, toCommaString(lastURLs)); > - } catch (IOException e) { > - monitor.report(e); > - } > + LayerNamePanel layerNamePanel = context.getLayerNamePanel(); > + Collection<Category> selectedCategories = layerNamePanel > + .getSelectedCategories(); > + LayerManager mgr = context.getLayerManager(); > + String categoryName = StandardCategoryNames.WORKING; > + if (!selectedCategories.isEmpty()) { > + categoryName = > selectedCategories.iterator().next().getName(); > + } > + mgr.addLayerable(categoryName, layer); > + String[] lastURLs = (String[]) dialog > + .getData(URLWizardPanel.URL_KEY); > + lastWMSVersion = (String) dialog > + .getData(URLWizardPanel.VERSION_KEY); > > - } > + > PersistentBlackboardPlugIn.get(context.getWorkbenchContext()).put( > + CACHED_URL_KEY, toCommaString(lastURLs)); > + } catch (IOException e) { > + monitor.report(e); > + } > > - private String toCommaString(String[] values) { > - StringBuilder string = new StringBuilder(); > - for (int i = 0; i < values.length; i++) { > - string.append(values[i]); > - if (i != values.length - 1) { > - string.append(","); > - } > } > - return string.toString(); > - } > > - private List<String> toLayerNames(List<MapLayer> mapLayers) { > - ArrayList<String> names = new ArrayList<String>(); > - for (MapLayer layer : mapLayers) { > - names.add(layer.getName()); > + private String toCommaString(String[] values) { > + StringBuilder string = new StringBuilder(); > + for (int i = 0; i < values.length; i++) { > + string.append(values[i]); > + if (i != values.length - 1) { > + string.append(","); > + } > + } > + return string.toString(); > } > - return names; > - } > > + private List<String> toLayerNames(List<MapLayer> mapLayers) { > + ArrayList<String> names = new ArrayList<String>(); > + for (MapLayer layer : mapLayers) { > + names.add(layer.getName()); > + } > + return names; > + } > + > } > > > ------------------------------------------------------------------------------ > 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