Browse Source

CHART-11090 地图模糊匹配

research/11.0
白岳 5 years ago
parent
commit
e4ddae1b6d
  1. 20
      designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java
  2. 8
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java

20
designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java

@ -8,7 +8,6 @@ import com.fr.chartx.data.DataSetDefinition;
import com.fr.chartx.data.DrillMapChartDataDefinition; import com.fr.chartx.data.DrillMapChartDataDefinition;
import com.fr.chartx.data.MapChartDataDefinition; import com.fr.chartx.data.MapChartDataDefinition;
import com.fr.chartx.data.execute.ExecuteDataSetHelper; import com.fr.chartx.data.execute.ExecuteDataSetHelper;
import com.fr.chartx.data.field.CollectionWithMapAreaAttr;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.TableDataSourceTailor; import com.fr.data.TableDataSourceTailor;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
@ -78,13 +77,10 @@ public class MapAreaMatchPane extends BasicBeanPane<VanChart> {
private static final Object[] HEADER_WITH_EMPTY = new Object[]{Toolkit.i18nText("Fine-Design_Chart_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_Match_To"), ""}; private static final Object[] HEADER_WITH_EMPTY = new Object[]{Toolkit.i18nText("Fine-Design_Chart_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_Match_To"), ""};
private MapType mapType;
private int level; private int level;
public MapAreaMatchPane(MapType mapType, int level, TwoTuple<DefaultMutableTreeNode, Set<String>> treeNodeAndItems) { public MapAreaMatchPane(int level, TwoTuple<DefaultMutableTreeNode, Set<String>> treeNodeAndItems) {
this.mapType = mapType;
this.level = level; this.level = level;
initButtonGroup(); initButtonGroup();
@ -209,7 +205,11 @@ public class MapAreaMatchPane extends BasicBeanPane<VanChart> {
matchResultTable.updateBean(matchResult); matchResultTable.updateBean(matchResult);
} }
public void populateBean(VanChart chart) { public void populateBean(VanChart vanChart) {
}
public void populateBean(VanChart chart, String comboBoxName, MapType mapType) {
//先取保存的数据集名称和区域名,若不存在,就取数据集面板配置的数据集名称和区域名 //先取保存的数据集名称和区域名,若不存在,就取数据集面板配置的数据集名称和区域名
MapMatchResult matchResult; MapMatchResult matchResult;
if (level < 0) { if (level < 0) {
@ -224,7 +224,7 @@ public class MapAreaMatchPane extends BasicBeanPane<VanChart> {
String tableName = matchResult.getTableName(); String tableName = matchResult.getTableName();
String areaName = matchResult.getColumnName(); String areaName = matchResult.getColumnName();
if (tableName == null) { if (tableName == null) {
DataSetDefinition dataSetDefinition = getDataSetDefinition(chart.getChartDataDefinition()); DataSetDefinition dataSetDefinition = getDataSetDefinition(chart.getChartDataDefinition(), mapType);
if (dataSetDefinition == null) { if (dataSetDefinition == null) {
return; return;
} }
@ -233,9 +233,7 @@ public class MapAreaMatchPane extends BasicBeanPane<VanChart> {
return; return;
} }
tableName = nameTableData.getName(); tableName = nameTableData.getName();
CollectionWithMapAreaAttr columnFieldCollection = (CollectionWithMapAreaAttr) dataSetDefinition.getColumnFieldCollection(); areaName = comboBoxName;
areaName = columnFieldCollection.getMatchColumn();
} }
tableNameCombox.setSelectedTableDataByName(tableName); tableNameCombox.setSelectedTableDataByName(tableName);
if (StringUtils.isEmpty(areaName)) { if (StringUtils.isEmpty(areaName)) {
@ -245,7 +243,7 @@ public class MapAreaMatchPane extends BasicBeanPane<VanChart> {
populateData(tableName, areaName); populateData(tableName, areaName);
} }
private DataSetDefinition getDataSetDefinition(ChartDataDefinitionProvider chartDataDefinitionProvider) { private DataSetDefinition getDataSetDefinition(ChartDataDefinitionProvider chartDataDefinitionProvider, MapType mapType) {
DataSetDefinition dataSetDefinition = null; DataSetDefinition dataSetDefinition = null;
if (chartDataDefinitionProvider instanceof MapChartDataDefinition) { if (chartDataDefinitionProvider instanceof MapChartDataDefinition) {
MapChartDataDefinition mapChartDataDefinition = (MapChartDataDefinition) chartDataDefinitionProvider; MapChartDataDefinition mapChartDataDefinition = (MapChartDataDefinition) chartDataDefinitionProvider;

8
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java

@ -1,9 +1,9 @@
package com.fr.design.chartx.fields.diff; package com.fr.design.chartx.fields.diff;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Utils;
import com.fr.chartx.TwoTuple; import com.fr.chartx.TwoTuple;
import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue; import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.component.MapAreaMatchPane; import com.fr.design.chartx.component.MapAreaMatchPane;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
@ -51,7 +51,7 @@ public abstract class MapDataSetFieldsPane<T extends ColumnFieldCollectionWithSe
return chart; return chart;
} }
public JPanel createAreaPanel(UIComboBox areaBox) { public JPanel createAreaPanel(final UIComboBox areaBox) {
JPanel areaPanel = new JPanel(new BorderLayout(10, 0)); JPanel areaPanel = new JPanel(new BorderLayout(10, 0));
areaBox.setPreferredSize(new Dimension(91, 20)); areaBox.setPreferredSize(new Dimension(91, 20));
areaPanel.add(areaBox, BorderLayout.WEST); areaPanel.add(areaBox, BorderLayout.WEST);
@ -64,8 +64,8 @@ public abstract class MapDataSetFieldsPane<T extends ColumnFieldCollectionWithSe
if (treeNodeAndItems == null) { if (treeNodeAndItems == null) {
treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(((VanChartMapPlot) chart.getPlot()).getGeoUrl(), level); treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(((VanChartMapPlot) chart.getPlot()).getGeoUrl(), level);
} }
final BasicBeanPane pane = new MapAreaMatchPane(MapDataSetFieldsPane.this.getMapType(), level, treeNodeAndItems); final MapAreaMatchPane pane = new MapAreaMatchPane(level, treeNodeAndItems);
pane.populateBean(chart); pane.populateBean(chart, Utils.objectToString(areaBox.getSelectedItem()), MapDataSetFieldsPane.this.getMapType());
BasicDialog dialog = pane.showWindow(new JFrame()); BasicDialog dialog = pane.showWindow(new JFrame());
dialog.addDialogActionListener(new DialogActionListener() { dialog.addDialogActionListener(new DialogActionListener() {
@Override @Override

Loading…
Cancel
Save