Browse Source

Merge pull request #12565 in DESIGN/design from bugfix/11.0 to release/11.0

* commit '673b6a6698395ebbe99af7c7d8fb61604bbb60f3':
  REPORT-96204 根据pr建议优化代码
  REPORT-96204 GISLayerType中GAO_DE_API命名回退下,考虑兼容问题,重构相关操作放后面
  REPORT-96204 FRBI海外版本地图组件的GIS图层优化
  REPORT-96204 FRBI海外版本地图组件的GIS图层优化
  REPORT-96966 fix: 显示字段下拉框
newui
superman 1 year ago
parent
commit
9884493815
  1. 77
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java

77
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java

@ -11,6 +11,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.plugin.chart.base.GisLayer;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.map.server.MapLayerConfigManager;
@ -29,6 +30,7 @@ import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.util.Locale;
/**
* @author Bjorn
@ -39,8 +41,16 @@ public class GisLayerPane extends JPanel implements UIObserver {
private UIButtonGroup gisButton;
private JPanel layerPaneCheckPane;
private UIComboBox gisGaoDeLayer;
private UIComboBox gisLayer;
/**
* 标准图层
*/
private UIComboBox standardLayers;
/**
* 自定义图层
*/
private UIComboBox customLayers;
private JPanel layerCardPane;
private WMSLayerPane wmsLayerPane;
@ -48,7 +58,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
private UIComboBox zoomLevel;
private String[] layers = MapLayerConfigManager.getLayerItems();
private String[] layers = MapLayerConfigManager.getCustomLayerItems();
public GisLayerPane() {
initComps();
@ -86,15 +96,12 @@ public class GisLayerPane extends JPanel implements UIObserver {
gisButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"),
Toolkit.i18nText("Fine-Design_Form_Widget_Style_Standard"), Toolkit.i18nText("Fine-Design_Chart_Custom")});
gisButton.setSelectedIndex(ChartEditContext.supportTheme() ? 0 : 1);
gisGaoDeLayer = new UIComboBox(MapLayerConfigManager.getGaoDeLayerItems());
gisButton.addActionListener(event -> {
refreshZoomLevel();
checkLayerCardPane();
});
gisGaoDeLayer.addItemListener(event -> refreshZoomLevel());
initCustomGISLayerPane();
initLayer();
initLayerCardPane();
layerPaneCheckPane = new JPanel(new CardLayout()) {
@ -104,15 +111,15 @@ public class GisLayerPane extends JPanel implements UIObserver {
return new Dimension(0, 0);
}
if (isStandardGis()) {
return gisGaoDeLayer.getPreferredSize();
return standardLayers.getPreferredSize();
} else {
return gisLayer.getPreferredSize();
return customLayers.getPreferredSize();
}
}
};
layerPaneCheckPane.add(new JPanel(), "auto");
layerPaneCheckPane.add(gisGaoDeLayer, "standard");
layerPaneCheckPane.add(gisLayer, "custom");
layerPaneCheckPane.add(standardLayers, "standard");
layerPaneCheckPane.add(customLayers, "custom");
double p = TableLayout.PREFERRED;
@ -142,7 +149,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
if (isStandardGis() || isAuto()) {
return new Dimension(0, 0);
}
String itemName = Utils.objectToString(gisLayer.getSelectedItem());
String itemName = Utils.objectToString(customLayers.getSelectedItem());
if (MapLayerConfigManager.isCustomLayer(itemName)) {
return tileLayerPane.getPreferredSize();
} else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) {
@ -163,10 +170,12 @@ public class GisLayerPane extends JPanel implements UIObserver {
}
}
private void initCustomGISLayerPane() {
gisLayer = new UIComboBox(layers);
private void initLayer() {
standardLayers = new UIComboBox(MapLayerConfigManager.getStandardLayerItems());
customLayers = new UIComboBox(layers);
gisLayer.addItemListener(e ->
standardLayers.addItemListener(event -> refreshZoomLevel());
customLayers.addItemListener(e ->
{
if (e.getStateChange() == ItemEvent.SELECTED) {
checkCustomLayerCardPane();
@ -175,7 +184,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
}
);
gisLayer.addPopupMenuListener(new PopupMenuListener() {
customLayers.addPopupMenuListener(new PopupMenuListener() {
public void popupMenuCanceled(PopupMenuEvent e) {
}
@ -184,12 +193,12 @@ public class GisLayerPane extends JPanel implements UIObserver {
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
String selected = Utils.objectToString(gisLayer.getSelectedItem());
String selected = Utils.objectToString(customLayers.getSelectedItem());
ZoomLevel zoomSelected = (ZoomLevel) zoomLevel.getSelectedItem();
gisLayer.setModel(new DefaultComboBoxModel(MapLayerConfigManager.getLayerItems()));
customLayers.setModel(new DefaultComboBoxModel(MapLayerConfigManager.getCustomLayerItems()));
gisLayer.setSelectedItem(selected);
customLayers.setSelectedItem(selected);
zoomLevel.setSelectedItem(zoomSelected);
}
});
@ -201,15 +210,15 @@ public class GisLayerPane extends JPanel implements UIObserver {
if (isAuto()) {
levels = MapStatusPane.ZOOM_LEVELS;
} else if (isStandardGis()) {
if (gisGaoDeLayer.getSelectedIndex() == gisGaoDeLayer.getItemCount() - 1) {
if (standardLayers.getSelectedIndex() == standardLayers.getItemCount() - 1) {
levels = MapStatusPane.ZOOM_LEVELS;
} else {
levels = MapStatusPane.GAODE_ZOOM_LEVELS;
}
} else {
if (ComparatorUtils.equals(gisLayer.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_Blue"))) {
if (ComparatorUtils.equals(customLayers.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_Blue"))) {
levels = MapStatusPane.BLUE_ZOOM_LEVELS;
} else if (ComparatorUtils.equals(gisLayer.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_GaoDe"))) {
} else if (ComparatorUtils.equals(customLayers.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_GaoDe"))) {
levels = MapStatusPane.GAODE_ZOOM_LEVELS;
} else {
levels = MapStatusPane.ZOOM_LEVELS;
@ -233,7 +242,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
private void checkCustomLayerCardPane() {
CardLayout cardLayout = (CardLayout) layerCardPane.getLayout();
cardLayout.show(layerCardPane, Utils.objectToString(gisLayer.getSelectedItem()));
cardLayout.show(layerCardPane, Utils.objectToString(customLayers.getSelectedItem()));
}
public void resetGisLayer(VanChartMapPlot mapPlot) {
@ -256,8 +265,12 @@ public class GisLayerPane extends JPanel implements UIObserver {
switch (layer.getGisLayerType()) {
case AUTO:
gisButton.setSelectedIndex(0);
layer.setGisLayerType(GISLayerType.AUTO);
layer.setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));
//dealWithTemplateTheme(layer);
break;
case GAO_DE_API:
populateStandardGis(layer);
case LAYER_NULL:
populateStandardGis(layer);
break;
@ -272,16 +285,22 @@ public class GisLayerPane extends JPanel implements UIObserver {
private void populateStandardGis(GisLayer layer) {
gisButton.setSelectedIndex(1);
String layerName = layer.getLayerName();
if (layer.getGisLayerType() == GISLayerType.LAYER_NULL) {
gisGaoDeLayer.setSelectedIndex(gisGaoDeLayer.getItemCount() - 1);
standardLayers.setSelectedIndex(standardLayers.getItemCount() - 1);
} else {
gisGaoDeLayer.setSelectedItem(layer.getGaoDeGisType().getTypeName());
if(Locale.CHINA.equals(GeneralContext.getLocale())) {
standardLayers.setSelectedItem(layerName);
layer.setGaoDeGisType(GaoDeGisType.parseByLocaleName(layerName));
} else {
standardLayers.setSelectedItem(layerName);
}
}
}
private void populateCustomGis(GisLayer layer) {
gisButton.setSelectedIndex(2);
gisLayer.setSelectedItem(layer.getShowItemName());
customLayers.setSelectedItem(layer.getShowItemName());
switch (layer.getGisLayerType()) {
case CUSTOM_WMS_LAYER:
@ -305,9 +324,9 @@ public class GisLayerPane extends JPanel implements UIObserver {
}
private void updateStandardGis(GisLayer layer) {
String layerName = Utils.objectToString(gisGaoDeLayer.getSelectedItem());
String layerName = Utils.objectToString(standardLayers.getSelectedItem());
layer.setLayerName(layerName);
if (gisGaoDeLayer.getSelectedIndex() == gisGaoDeLayer.getItemCount() - 1) {
if (standardLayers.getSelectedIndex() == standardLayers.getItemCount() - 1) {
layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName));
} else {
layer.setGisLayerType(GISLayerType.GAO_DE_API);
@ -316,7 +335,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
}
private void updateCustomGis(GisLayer layer) {
String layerName = Utils.objectToString(gisLayer.getSelectedItem());
String layerName = Utils.objectToString(customLayers.getSelectedItem());
layer.setLayerName(layerName);
layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName));

Loading…
Cancel
Save