From e35e8f5e6dc4c1a8083ec7b6131a5fb453419ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 2 Mar 2020 09:49:49 +0800 Subject: [PATCH] =?UTF-8?q?CHART-11090=20=E5=9C=B0=E5=9B=BE=E6=A8=A1?= =?UTF-8?q?=E7=B3=8A=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chartx/component/MapAreaMatchPane.java | 2 +- .../chart/gui/data/NormalChartDataPane.java | 13 ++- .../chart/gui/data/TableDataPane.java | 9 ++ .../table/AbstractTableDataContentPane.java | 12 ++- .../designer/data/comp/DrillMapDataPane.java | 10 ++- .../designer/data/comp/DrillMapLayerPane.java | 13 ++- .../comp/EachLayerDataDefinitionPane.java | 7 +- .../comp/SingleLayerDataDefinitionPane.java | 5 ++ .../type/VanChartDrillMapPlotPane.java | 23 +++++ .../fr/van/chart/map/VanMapChartTypeUI.java | 6 +- .../designer/data/VanChartMapDataPane.java | 32 +++++-- .../VanAreaMapPlotTableDataContentPane.java | 7 +- .../VanLineMapPlotTableDataContentPane.java | 60 ++++++++++++- .../table/VanMapTableDataContentPane.java | 90 +++++++++++++++++++ .../VanPointMapPlotTableDataContentPane.java | 31 ++++++- .../designer/type/VanChartMapPlotPane.java | 16 ++++ 16 files changed, 305 insertions(+), 31 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java index 708b993652..f37a01c220 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java @@ -196,7 +196,7 @@ public class MapAreaMatchPane extends BasicBeanPane { //先取保存的数据集名称和区域名,若不存在,就取数据集面板配置的数据集名称和区域名 matchResultTable.populateBean(matchResult); - if (matchResult != null && matchResult.getTableName() != null) { + if (matchResult != null && StringUtils.isNotEmpty(matchResult.getTableName())) { tableName = matchResult.getTableName(); areaName = matchResult.getColumnName(); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index 1277ae4632..42cf782c35 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -8,16 +8,15 @@ import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.van.chart.designer.AbstractVanChartScrollPane; import javax.swing.BorderFactory; import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; -import java.util.ArrayList; -import java.util.List; /** * 一般数据界面 @@ -133,6 +132,14 @@ public class NormalChartDataPane extends DataContentsPane { tableDataPane.checkBoxUse(); } + /** + * 钻取地图需要同时更新层级 + */ + public void populate(ChartCollection collection, int level) { + populate(collection); + tableDataPane.refreshLevel(level); + } + /** * 保存 数据界面内容 */ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java index 7f22a03a6b..f8092b859e 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java @@ -15,6 +15,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.van.chart.map.designer.data.contentpane.table.VanMapTableDataContentPane; import javax.swing.BorderFactory; import java.awt.BorderLayout; @@ -75,6 +76,7 @@ public class TableDataPane extends FurtherBasicBeanPane{ } if(dataContentPane != null) { dataContentPane.onSelectTableData(dataWrap); + dataContentPane.setTableName(dataWrap.getTableDataName()); } } @@ -124,6 +126,13 @@ public class TableDataPane extends FurtherBasicBeanPane{ add(dataContentPane, BorderLayout.CENTER); } } + + public void refreshLevel(int level){ + if(dataContentPane instanceof VanMapTableDataContentPane) { + ((VanMapTableDataContentPane) dataContentPane).setLevel(level); + } + } + /** * 更新界面属性 */ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java index df5d99fbdb..1bfb9657cc 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java @@ -6,16 +6,26 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.gui.icombobox.UIComboBox; import javax.swing.JSeparator; +import java.util.List; import java.awt.Dimension; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.List; public abstract class AbstractTableDataContentPane extends BasicBeanPane{ protected static final double COMPONENT_WIDTH = 124; private boolean isNeedSummaryCaculateMethod = true; + + public String tableName; + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } public abstract void updateBean(ChartCollection ob); diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java index 5b441f7db4..4ac2b2528c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java @@ -8,12 +8,15 @@ import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; +import com.fr.plugin.chart.map.MapMatchResult; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.type.MapType; import com.fr.van.chart.map.designer.data.MapDataPaneHelper; -import java.awt.BorderLayout; import java.util.ArrayList; import java.util.List; +import java.awt.BorderLayout; /** * Created by Mitisky on 16/6/20. @@ -76,8 +79,11 @@ public class DrillMapDataPane extends BasicBeanPane { dataDefinitionType.setSelectedIndex(MapDataPaneHelper.isFromBottomData(ob) ? 0 : 1); + MapMatchResult matchResult = ((VanChartMapPlot) ob.getSelectedChartProvider(Chart.class).getPlot()).getMatchResult(); ChartCollection bottomDataChartCollection = MapDataPaneHelper.getBottomDataDrillMapChartCollection(ob); - bottomDataDefinitionPane.populateBean(bottomDataChartCollection); + ((VanChartMapPlot)bottomDataChartCollection.getSelectedChartProvider(Chart.class).getPlot()).setMatchResult(matchResult); + + bottomDataDefinitionPane.populateBean(bottomDataChartCollection, ChartGEOJSONHelper.BOTTOM_LEVEL); eachLayerDataDefinitionPane.populateBean(ob); parent.initAllListeners(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java index 6fd6ecabbc..a01aed4cd7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java @@ -7,9 +7,9 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.ComparatorUtils; - import com.fr.plugin.chart.drillmap.DrillMapHelper; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.map.MapMatchResult; import com.fr.plugin.chart.map.server.CompatibleGeoJSONTreeHelper; import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.ZoomLevel; @@ -19,10 +19,11 @@ import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.tree.DefaultMutableTreeNode; -import java.awt.BorderLayout; -import java.awt.Component; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; +import java.awt.BorderLayout; +import java.awt.Component; /** * Created by Mitisky on 16/6/20. @@ -125,6 +126,7 @@ public class DrillMapLayerPane extends BasicScrollPane { if (drillMapPlot != null) { java.util.List levelList = drillMapPlot.getLayerLevelList(); java.util.List mapTypeList = drillMapPlot.getLayerMapTypeList(); + List matchResultList = drillMapPlot.getMatchResultList(); if (detailComps == null || drillMapPlot.getMapType() != oldMapType || !ComparatorUtils.equals(drillMapPlot.getGeoUrl(), oldGeoUrl)) { oldMapType = drillMapPlot.getMapType(); @@ -151,6 +153,11 @@ public class DrillMapLayerPane extends BasicScrollPane { mapTypeList.add(mapType); } + int matchSize = matchResultList.size(); + for (int k = matchSize; k < depth; k++) { + matchResultList.add(new MapMatchResult()); + } + for (int i = 0; i < depth; i++) { Component[] components = detailComps[i + 1]; if (components != null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java index 26f8c42c3c..16d989829c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java @@ -11,14 +11,15 @@ import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.drillmap.DrillMapHelper; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; +import com.fr.plugin.chart.map.MapMatchResult; import com.fr.plugin.chart.map.server.CompatibleGeoJSONTreeHelper; import com.fr.plugin.chart.type.MapType; import com.fr.van.chart.map.designer.data.MapDataPaneHelper; import javax.swing.tree.DefaultMutableTreeNode; -import java.awt.CardLayout; import java.util.ArrayList; import java.util.List; +import java.awt.CardLayout; /** * Created by Mitisky on 16/6/20. @@ -90,12 +91,14 @@ public class EachLayerDataDefinitionPane extends MultiTabPane { } private void populatePaneList(ChartCollection chartCollection) { + List matchResultList = ((VanChartDrillMapPlot) chartCollection.getSelectedChartProvider(Chart.class).getPlot()).getMatchResultList(); for (int i = 0, len = paneList.size(); i < len; i++) { BasicPane basicPane = paneList.get(i); MapType mapType = oldMapList.get(i); if (basicPane instanceof SingleLayerDataDefinitionPane) { ChartCollection clone = MapDataPaneHelper.getLayerChartCollection(chartCollection, i, mapType); - ((SingleLayerDataDefinitionPane) basicPane).populateBean(clone); + ((VanChartDrillMapPlot)clone.getSelectedChartProvider(Chart.class).getPlot()).setMatchResultList(matchResultList); + ((SingleLayerDataDefinitionPane) basicPane).populateBean(clone, i); } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java index 1aca1a32db..16906845e7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java @@ -78,6 +78,11 @@ public class SingleLayerDataDefinitionPane extends FurtherBasicBeanPane newMatchResultList = new ArrayList<>(); + List matchResultList = ((VanChartDrillMapPlot) oldPlot).getMatchResultList(); + if (matchResultList != null) { + for (MapMatchResult matchResult : matchResultList) { + newMatchResultList.add((MapMatchResult) matchResult.clone()); + } + } + ((VanChartDrillMapPlot) newPlot).setMatchResultList(newMatchResultList); + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error("Error in change plot"); + } + } protected Chart[] getDefaultCharts() { return DrillMapIndependentVanChart.DrillMapVanCharts; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java index 07cb2cbd68..50636ad28f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java @@ -21,6 +21,7 @@ import com.fr.van.chart.map.designer.data.contentpane.report.VanLineMapPlotRepor import com.fr.van.chart.map.designer.data.contentpane.report.VanPointMapPlotReportDataContentPane; import com.fr.van.chart.map.designer.data.contentpane.table.VanAreaMapPlotTableDataContentPane; import com.fr.van.chart.map.designer.data.contentpane.table.VanLineMapPlotTableDataContentPane; +import com.fr.van.chart.map.designer.data.contentpane.table.VanMapTableDataContentPane; import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; import com.fr.van.chart.map.designer.other.VanChartMapOtherPane; import com.fr.van.chart.map.designer.other.condition.pane.VanChartMapConditionPane; @@ -77,9 +78,12 @@ public class VanMapChartTypeUI extends AbstractIndependentVanChartUI { //图表数据结构 恢复用注释。删除下面5个方法 getTableDataSourcePane getReportDataSourcePane getChartDataPane areaPlot linePlot。 public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { - return areaPlot(plot) ? new VanAreaMapPlotTableDataContentPane(parent) + VanMapTableDataContentPane vanMapTableDataContentPane = areaPlot(plot) ? new VanAreaMapPlotTableDataContentPane(parent) : linePlot(plot) ? new VanLineMapPlotTableDataContentPane(parent) : new VanPointMapPlotTableDataContentPane(parent); + + vanMapTableDataContentPane.setPlot((VanChartMapPlot)plot); + return vanMapTableDataContentPane; } public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java index a6fdd49ce6..e7a222bf9d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java @@ -1,9 +1,12 @@ package com.fr.van.chart.map.designer.data; +import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; +import com.fr.plugin.chart.map.MapMatchResult; +import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.data.VanMapDefinition; import com.fr.plugin.chart.type.MapType; @@ -54,26 +57,37 @@ public class VanChartMapDataPane extends ChartDataPane { repeatLayout(collection); + MapMatchResult matchResult = ((VanChartMapPlot) collection.getSelectedChartProvider(Chart.class).getPlot()).getMatchResult(); + + ChartCollection areaClone; + ChartCollection pointClone; + ChartCollection lineClone; switch (mapType) { case AREA: - ChartCollection areaClone = MapDataPaneHelper.getAreaMapChartCollection(collection); + areaClone = MapDataPaneHelper.getAreaMapChartCollection(collection); + ((VanChartMapPlot)areaClone.getSelectedChartProvider(Chart.class).getPlot()).setMatchResult(matchResult); contentsPane.populate(areaClone); break; case POINT: - ChartCollection pointClone = MapDataPaneHelper.getPointMapChartCollection(collection); + pointClone = MapDataPaneHelper.getPointMapChartCollection(collection); + ((VanChartMapPlot)pointClone.getSelectedChartProvider(Chart.class).getPlot()).setMatchResult(matchResult); contentsPane.populate(pointClone); break; case LINE: - ChartCollection lineClone = MapDataPaneHelper.getLineMapChartCollection(collection); + lineClone = MapDataPaneHelper.getLineMapChartCollection(collection); + ((VanChartMapPlot)lineClone.getSelectedChartProvider(Chart.class).getPlot()).setMatchResult(matchResult); contentsPane.populate(lineClone); break; case CUSTOM: - ChartCollection areaClone1 = MapDataPaneHelper.getAreaMapChartCollection(collection); - ChartCollection pointClone1 = MapDataPaneHelper.getPointMapChartCollection(collection); - ChartCollection lineClone1 = MapDataPaneHelper.getLineMapChartCollection(collection); - ((CustomMapChartDataContentsPane) contentsPane).populateAreaMap(areaClone1); - ((CustomMapChartDataContentsPane) contentsPane).populatePointMap(pointClone1); - ((CustomMapChartDataContentsPane) contentsPane).populateLineMap(lineClone1); + areaClone = MapDataPaneHelper.getAreaMapChartCollection(collection); + pointClone = MapDataPaneHelper.getPointMapChartCollection(collection); + lineClone = MapDataPaneHelper.getLineMapChartCollection(collection); + ((VanChartMapPlot)areaClone.getSelectedChartProvider(Chart.class).getPlot()).setMatchResult(matchResult); + ((VanChartMapPlot)pointClone.getSelectedChartProvider(Chart.class).getPlot()).setMatchResult(matchResult); + ((VanChartMapPlot)lineClone.getSelectedChartProvider(Chart.class).getPlot()).setMatchResult(matchResult); + ((CustomMapChartDataContentsPane) contentsPane).populateAreaMap(areaClone); + ((CustomMapChartDataContentsPane) contentsPane).populatePointMap(pointClone); + ((CustomMapChartDataContentsPane) contentsPane).populateLineMap(lineClone); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java index b8c1d3a756..86bc0c6d09 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java @@ -8,7 +8,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider; import com.fr.van.chart.map.designer.data.component.SeriesTypeUseComboxPaneWithOutFilter; @@ -16,17 +15,17 @@ import com.fr.van.chart.map.designer.data.component.SeriesTypeUseComboxPaneWithO import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JSeparator; +import java.util.List; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.List; /** * Created by Mitisky on 16/5/16. */ -public class VanAreaMapPlotTableDataContentPane extends AbstractTableDataContentPane { +public class VanAreaMapPlotTableDataContentPane extends VanMapTableDataContentPane { private UIComboBox areaNameCom; protected SeriesTypeUseComboxPaneWithOutFilter seriesTypeUseComboxPane; @@ -72,7 +71,7 @@ public class VanAreaMapPlotTableDataContentPane extends AbstractTableDataContent double[] rowSize = {p}; Component[][] components = new Component[][]{ - new Component[]{label, areaNameCom}, + new Component[]{label, createAreaPanel(areaNameCom)}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java index abbddc7321..dd50492f20 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java @@ -1,10 +1,15 @@ package com.fr.van.chart.map.designer.data.contentpane.table; +import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.van.chart.map.designer.data.component.table.AbstractLongLatAreaPane; +import com.fr.van.chart.map.designer.data.component.table.AreaPane; import com.fr.van.chart.map.designer.data.component.table.LineMapAreaPane; import com.fr.van.chart.map.designer.data.component.table.LineMapLongLatAreaPane; +import com.fr.van.chart.map.designer.data.component.table.LongLatAreaPane; + +import java.awt.Component; /** @@ -16,10 +21,61 @@ public class VanLineMapPlotTableDataContentPane extends VanPointMapPlotTableData } protected AbstractLongLatAreaPane createAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { - return new LineMapAreaPane(longLatAreaTableComboPane); + return new LineMapAreaPane(longLatAreaTableComboPane) { + @Override + protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + areaPane = new AreaPane(parentPane) { + @Override + protected Component[][] getComponent () { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name")), VanLineMapPlotTableDataContentPane.this.createAreaPanel(areaNameCom)} + }; + } + }; + } + @Override + protected void initEndAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + endAreaPane = new AreaPane(parentPane) { + @Override + protected Component[][] getComponent () { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")), VanLineMapPlotTableDataContentPane.this.createAreaPanel(areaNameCom)} + }; + } + }; + } + }; } protected AbstractLongLatAreaPane createLongLatAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { - return new LineMapLongLatAreaPane(longLatAreaTableComboPane); + return new LineMapLongLatAreaPane(longLatAreaTableComboPane){ + @Override + protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + areaPane = new LongLatAreaPane(parentPane) { + @Override + protected Component[][] getComponent () { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Longitude")), longitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Latitude")), latitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name")), VanLineMapPlotTableDataContentPane.this.createAreaPanel(areaNameCom)} + }; + } + }; + } + + @Override + protected void initEndAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + endAreaPane = new LongLatAreaPane(parentPane){ + @Override + protected Component[][] getComponent () { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Longitude")), longitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Latitude")), latitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")), VanLineMapPlotTableDataContentPane.this.createAreaPanel(areaNameCom)} + }; + } + }; + } + }; } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java new file mode 100644 index 0000000000..a8cae03c97 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java @@ -0,0 +1,90 @@ +package com.fr.van.chart.map.designer.data.contentpane.table; + +import com.fr.base.BaseUtils; +import com.fr.base.Utils; +import com.fr.chartx.TwoTuple; +import com.fr.design.chartx.component.MapAreaMatchPane; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionListener; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.plugin.chart.map.MapMatchResult; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.tree.DefaultMutableTreeNode; +import java.util.Set; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-12-25 + */ +public abstract class VanMapTableDataContentPane extends AbstractTableDataContentPane { + + private VanChartMapPlot plot; + + //钻取地图有层级,默认-1代表无层级关系 + private int level = ChartGEOJSONHelper.DEFAULT_LEVEL; + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public VanChartMapPlot getPlot() { + return plot; + } + + public void setPlot(VanChartMapPlot plot) { + this.plot = plot; + } + + public JPanel createAreaPanel(final UIComboBox areaBox) { + JPanel areaPanel = new JPanel(new BorderLayout(4, 0)); + areaBox.setPreferredSize(new Dimension(70, 20)); + areaPanel.add(areaBox, BorderLayout.CENTER); + UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); + uiButton.addActionListener(new ActionListener() { + private TwoTuple> treeNodeAndItems; + + @Override + public void actionPerformed(ActionEvent e) { + if (treeNodeAndItems == null) { + treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(plot.getGeoUrl(), level); + } + final MapAreaMatchPane pane = new MapAreaMatchPane(treeNodeAndItems); + + String nameTable = getTableName(); + final MapMatchResult matchResult = plot.getMatchResult(level); + + pane.populateBean(matchResult, nameTable, Utils.objectToString(areaBox.getSelectedItem())); + BasicDialog dialog = pane.showWindow(new JFrame()); + dialog.addDialogActionListener(new DialogActionListener() { + @Override + public void doOk() { + pane.updateBean(matchResult); + } + + @Override + public void doCancel() { + + } + }); + dialog.setVisible(true); + } + }); + areaPanel.add(uiButton, BorderLayout.EAST); + return areaPanel; + } +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java index 724da26752..cbb418b8d8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java @@ -2,12 +2,15 @@ package com.fr.van.chart.map.designer.data.contentpane.table; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider; import com.fr.van.chart.map.designer.data.component.table.AbstractLongLatAreaPane; +import com.fr.van.chart.map.designer.data.component.table.AreaPane; +import com.fr.van.chart.map.designer.data.component.table.LongLatAreaPane; import com.fr.van.chart.map.designer.data.component.table.PointMapAreaPane; import com.fr.van.chart.map.designer.data.component.table.PointMapLongLatAreaPane; @@ -15,11 +18,11 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; -import java.util.List; /** * Created by Mitisky on 16/5/17. @@ -214,11 +217,33 @@ public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableData } protected AbstractLongLatAreaPane createAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { - return new PointMapAreaPane(longLatAreaTableComboPane); + return new PointMapAreaPane(longLatAreaTableComboPane) { + protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + areaPane = new AreaPane(parentPane) { + protected Component[][] getComponent () { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name")), VanPointMapPlotTableDataContentPane.this.createAreaPanel(areaNameCom)} + }; + } + }; + } + }; } protected AbstractLongLatAreaPane createLongLatAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { - return new PointMapLongLatAreaPane(longLatAreaTableComboPane); + return new PointMapLongLatAreaPane(longLatAreaTableComboPane) { + protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + areaPane = new LongLatAreaPane(parentPane) { + protected Component[][] getComponent () { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude")), longitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude")), latitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Name")), VanPointMapPlotTableDataContentPane.this.createAreaPanel(areaNameCom)} + }; + } + }; + } + }; } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java index 8f44c0a9bc..b9cdaad467 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java @@ -10,6 +10,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.map.MapIndependentVanChart; +import com.fr.plugin.chart.map.MapMatchResult; import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.data.VanMapDefinition; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; @@ -90,6 +91,21 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { } } + /** + * 同一个地图, 类型之间切换 + */ + @Override + protected void cloneOldPlot2New(Plot oldPlot, Plot newPlot) { + super.cloneOldPlot2New(oldPlot, newPlot); + try { + if (((VanChartMapPlot) oldPlot).getMatchResult() != null) { + ((VanChartMapPlot) newPlot).setMatchResult((MapMatchResult) ((VanChartMapPlot) oldPlot).getMatchResult().clone()); + } + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error("Error in change plot"); + } + } + /** * 不同地图类型的超链不需要复制 *