|
|
|
@ -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: |
|
|
|
|
case STANDARD: |
|
|
|
|
populateStandardGis(layer); |
|
|
|
|
case LAYER_NULL: |
|
|
|
|
populateStandardGis(layer); |
|
|
|
|
break; |
|
|
|
@ -272,16 +285,23 @@ 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); |
|
|
|
|
layer.setGisLayerType(GISLayerType.LAYER_NULL); |
|
|
|
|
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: |
|
|
|
@ -295,6 +315,8 @@ public class GisLayerPane extends JPanel implements UIObserver {
|
|
|
|
|
|
|
|
|
|
public void update(GisLayer layer) { |
|
|
|
|
if (isAuto()) { |
|
|
|
|
//如果是海外环境,切换为mapbox的内容
|
|
|
|
|
//浅色主题为mapbox,深色主题为黑色
|
|
|
|
|
layer.setGisLayerType(GISLayerType.AUTO); |
|
|
|
|
layer.setLayerName(GISLayerType.getLocString(GISLayerType.AUTO)); |
|
|
|
|
} else if (isStandardGis()) { |
|
|
|
@ -305,18 +327,20 @@ public class GisLayerPane extends JPanel implements UIObserver {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateStandardGis(GisLayer layer) { |
|
|
|
|
String layerName = Utils.objectToString(gisGaoDeLayer.getSelectedItem()); |
|
|
|
|
//海外情况下
|
|
|
|
|
//标准:黑色、mapbox、清新、素雅、午夜、无,默认选中mapbox
|
|
|
|
|
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); |
|
|
|
|
layer.setGisLayerType(GISLayerType.STANDARD); |
|
|
|
|
layer.setGaoDeGisType(GaoDeGisType.parseByLocaleName(layerName)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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)); |
|
|
|
|
|
|
|
|
|