From a3e89e1e1752ee9c94f7742e87c1201d384c03c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 10 May 2021 16:26:10 +0800 Subject: [PATCH] =?UTF-8?q?CHART-19174=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89wms=E5=B8=A6token=E6=97=A0=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/map/designer/type/WMSLayerPane.java | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java index 19afd688f6..67369d826f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java @@ -1,6 +1,6 @@ package com.fr.van.chart.map.designer.type; -import com.fr.decision.webservice.v10.map.WMSFactory; +import com.fr.decision.webservice.v10.map.MapEditService; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -11,7 +11,6 @@ import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.http.HttpClient; import com.fr.plugin.chart.base.GisLayer; import com.fr.plugin.chart.map.layer.WMSLayer; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -85,21 +84,13 @@ public class WMSLayerPane extends JPanel implements UIObserver { public void actionPerformed(ActionEvent e) { new SwingWorker() { - private java.util.List list = new ArrayList<>(); + private List list = new ArrayList<>(); @Override protected Void doInBackground() { - HttpClient httpClient = new HttpClient(wmsUrl.getText() + "service=WMS&request=GetCapabilities"); - httpClient.asGet(); - - if (!httpClient.isServerAlive()) { - return null; - } - - String res = httpClient.getResponseText(); - List layers = WMSFactory.readLayers(res); + List wmsNames = MapEditService.getInstance().getWMSNames(wmsUrl.getText()); list.clear(); - for (String layer : layers) { + for (String layer : wmsNames) { list.add(new WMSLayer(layer, false)); } return null; @@ -108,9 +99,8 @@ public class WMSLayerPane extends JPanel implements UIObserver { @Override protected void done() { connectButton.setText(Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); - if (list != null && list.size() > 0) { - resetWMSLayerPane(list); - } else { + resetWMSLayerPane(list); + if (list == null || list.isEmpty()) { FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Chart_Invalid_WMS")); } }