Browse Source

CHART-17494 修改点地图标记点

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
74f382550f
  1. 154
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java
  2. 3
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapConditionAttrContentPane.java
  3. 42
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/item/VanChartAnchorMarkerConditionPane.java
  4. 26
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartAnchorPointMapConditionPane.java
  5. 64
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java

154
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -37,6 +37,7 @@ import com.fr.van.chart.designer.component.marker.VanChartImageMarkerPane;
import com.fr.van.chart.designer.other.VanChartInteractivePane;
import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane;
import com.fr.van.chart.designer.style.series.VanChartEffectPane;
import com.fr.van.chart.map.designer.style.series.VanChartMapAnchorMarkerPane;
import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane;
import com.fr.van.chart.map.line.VanChartCurvePane;
import com.fr.van.chart.map.line.VanChartLineMapEffectPane;
@ -61,16 +62,24 @@ import java.awt.event.ItemListener;
* 地图-系列界面
*/
public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
private static final String AREA_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Region");
private static final String POINT_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point");
private static final String LINE_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Flow");
private static final String AREA_STRING = Toolkit.i18nText("Fine-Design_Chart_Region");
private static final String POINT_STRING = Toolkit.i18nText("Fine-Design_Chart_Point");
private static final String LINE_STRING = Toolkit.i18nText("Fine-Design_Chart_Flow");
private static final String[] MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(),
private static final String[] MARKER_TYPES = new String[]{MapMarkerType.ANCHOR.toLocalString(),
MapMarkerType.COMMON.toLocalString(), MapMarkerType.BUBBLE.toLocalString(), MapMarkerType.IMAGE.toLocalString()};
private static final String[] LARGE_MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(),
private static final String[] LARGE_MARKER_TYPES = new String[]{MapMarkerType.ANCHOR.toLocalString(),
MapMarkerType.COMMON.toLocalString(), MapMarkerType.BUBBLE.toLocalString()};
private static final String[] COMPATIBLE_MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(),
MapMarkerType.ANCHOR.toLocalString(), MapMarkerType.COMMON.toLocalString(),
MapMarkerType.BUBBLE.toLocalString(), MapMarkerType.IMAGE.toLocalString()};
private static final String[] COMPATIBLE_LARGE_MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(),
MapMarkerType.ANCHOR.toLocalString(), MapMarkerType.COMMON.toLocalString(),
MapMarkerType.BUBBLE.toLocalString()};
//custom
private UIButtonGroup<Integer> areaPointAndLineGroup;
@ -85,9 +94,15 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
//point
private UIComboBox markerTypeCom;
private VanChartMapAnchorMarkerPane anchorMarkerPane;
private VanChartMapScatterMarkerPane commonMarkerPane;
private VanChartBubblePane bubblePane;
private VanChartImageMarkerPane imageMarkerPane;
private CardLayout markerTypeLayout;
private JPanel markerContentPane;
private UINumberDragPane pointAlphaPane;
private VanChartEffectPane pointEffectPane;
@ -147,7 +162,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
checkLineMapLarge();
}
});
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Model"), lineMapLargeDataModelGroup);
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Large_Model"), lineMapLargeDataModelGroup);
return createLargeDataModelPane(panel);
}
@ -162,14 +177,11 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
if (pointEffectPane != null) {
GUICoreUtils.setEnabled(pointEffectPane, !largeModel);
}
if (markerTypeCom != null) {
Object selectedItem = markerTypeCom.getSelectedItem();
markerTypeCom.setModel(new DefaultComboBoxModel(largeModel ? LARGE_MARKER_TYPES : MARKER_TYPES));
if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedItem) && largeModel) {
markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString());
} else {
markerTypeCom.setSelectedItem(selectedItem);
}
checkMarkerComboboxModel((VanChartMapPlot) plot);
if (largeModel) {
checkLargeModelPlotSelectedItem();
}
}
@ -182,6 +194,61 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
}
}
private void checkMarkerComboboxModel(VanChartMapPlot plot) {
if (markerTypeCom == null) {
return;
}
if (shouldRefreshComboboxModel(plot)) {
refreshMarkerTypeComboboxModel(plot);
markerTypeCom.setSelectedItem(plot.getMapMarkerType().toLocalString());
if (markerTypeLayout != null && markerContentPane != null) {
markerTypeLayout.show(markerContentPane, plot.getMapMarkerType().toLocalString());
}
}
}
private void checkLargeModelPlotSelectedItem() {
MapMarkerType selectedType = (MapMarkerType) markerTypeCom.getSelectedItem();
if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedType)) {
markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString());
} else {
markerTypeCom.setSelectedItem(selectedType);
}
}
private boolean shouldRefreshComboboxModel(VanChartMapPlot plot) {
MapMarkerType selectedType = plot.getMapMarkerType();
DefaultComboBoxModel model = (DefaultComboBoxModel) markerTypeCom.getModel();
if (selectedType == MapMarkerType.DEFAULT) {
return model.getIndexOf(MapMarkerType.DEFAULT.toLocalString()) < 0;
}
return model.getIndexOf(MapMarkerType.DEFAULT.toLocalString()) > -1;
}
private void refreshMarkerTypeComboboxModel(VanChartMapPlot plot) {
if (largeModel(plot)) {
if (plot.getMapMarkerType() == MapMarkerType.DEFAULT) {
markerTypeCom.setModel(new DefaultComboBoxModel<>(COMPATIBLE_LARGE_MARKER_TYPES));
} else {
markerTypeCom.setModel(new DefaultComboBoxModel<>(LARGE_MARKER_TYPES));
}
} else {
if (plot.getMapMarkerType() == MapMarkerType.DEFAULT) {
markerTypeCom.setModel(new DefaultComboBoxModel<>(COMPATIBLE_MARKER_TYPES));
} else {
markerTypeCom.setModel(new DefaultComboBoxModel<>(MARKER_TYPES));
}
}
}
@Override
protected JPanel getContentPane(boolean custom) {
JPanel panel = new JPanel(new BorderLayout());
@ -272,7 +339,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
Component[][] components = new Component[][]{
new Component[]{getColorPane(MapType.AREA)},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderWithAlphaPane)},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderWithAlphaPane)},
};
return TableLayoutHelper.createTableLayoutPane(components, row, col);
@ -357,28 +424,29 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
private Component createCurvePane() {
curvePane = new VanChartCurvePane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve"), curvePane);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Curve"), curvePane);
}
private Component createAnimationPane() {
lineMapEffectPane = new VanChartLineMapEffectPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), lineMapEffectPane);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Animation"), lineMapEffectPane);
}
//不透明度
private JPanel createPointAlphaPane() {
pointAlphaPane = new UINumberDragPane(0, 100);
return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane);
return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane);
}
private JPanel createPointEffectPane() {
pointEffectPane = new VanChartEffectPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), pointEffectPane);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Animation"), pointEffectPane);
}
private JPanel createMarkerComPane() {
markerTypeCom = new UIComboBox(MARKER_TYPES);
markerTypeCom = new UIComboBox(COMPATIBLE_MARKER_TYPES);
anchorMarkerPane = new VanChartMapAnchorMarkerPane();
commonMarkerPane = new VanChartMapScatterMarkerPane();
commonMarkerPane.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER);
bubblePane = new VanChartBubblePane() {
@ -396,31 +464,34 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
};
imageMarkerPane = new VanChartImageMarkerPane();
final JPanel[] panes = new JPanel[]{new JPanel(), commonMarkerPane, bubblePane, imageMarkerPane};
final CardLayout cardLayout = new CardLayout();
final JPanel cardPane = new JPanel(cardLayout) {
final JPanel[] panes = new JPanel[]{new JPanel(), anchorMarkerPane, commonMarkerPane, bubblePane, imageMarkerPane};
markerTypeLayout = new CardLayout();
markerContentPane = new JPanel(markerTypeLayout) {
@Override
public Dimension getPreferredSize() {
return panes[markerTypeCom.getSelectedIndex()].getPreferredSize();
int index = MapMarkerType.parse((String) markerTypeCom.getSelectedItem()).ordinal();
return panes[index].getPreferredSize();
}
};
for (int i = 0, len = MARKER_TYPES.length; i < len; i++) {
cardPane.add(panes[i], MARKER_TYPES[i]);
for (int i = 0, len = COMPATIBLE_MARKER_TYPES.length; i < len; i++) {
markerContentPane.add(panes[i], COMPATIBLE_MARKER_TYPES[i]);
}
markerTypeCom.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
cardLayout.show(cardPane, MARKER_TYPES[markerTypeCom.getSelectedIndex()]);
markerTypeLayout.show(markerContentPane, (String) markerTypeCom.getSelectedItem());
}
});
JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point_Style"), markerTypeCom);
JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Point_Style"), markerTypeCom);
JPanel markerPane = new JPanel(new BorderLayout(0, 6));
markerPane.add(northPane, BorderLayout.NORTH);
markerPane.add(cardPane, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane);
markerPane.add(markerContentPane, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane);
}
private JPanel createCustomPane(Plot plot) {
@ -500,8 +571,9 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
}
public void populateBean(Plot plot) {
if (plot != null && plot instanceof VanChartMapPlot) {
if (plot instanceof VanChartMapPlot) {
if (markerTypeCom != null) {
checkMarkerComboboxModel(((VanChartMapPlot) plot));
markerTypeCom.setSelectedItem(((VanChartMapPlot) plot).getMapMarkerType().toLocalString());
}
if (nullValueColorBox != null) {
@ -524,9 +596,10 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
}
public void updateBean(Plot plot) {
if (plot != null && plot instanceof VanChartMapPlot) {
if (plot instanceof VanChartMapPlot) {
if (markerTypeCom != null) {
((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parseInt(markerTypeCom.getSelectedIndex()));
((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parse((String) markerTypeCom.getSelectedItem()));
checkMarkerComboboxModel((VanChartMapPlot) plot);
}
if (nullValueColorBox != null) {
//TODO Bjorn 地图空值背景自动
@ -587,6 +660,10 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
}
VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class);
if (anchorMarkerPane != null) {
anchorMarkerPane.populateBean(attrMarker);
}
if (commonMarkerPane != null) {
commonMarkerPane.populateBean(attrMarker);
}
@ -669,11 +746,16 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class);
defaultAttr.remove(attrBubble);
if (markerTypeCom != null) {
if (markerTypeCom.getSelectedIndex() == 1) {
String selected = (String) markerTypeCom.getSelectedItem();
MapMarkerType markerType = MapMarkerType.parse(selected);
if (markerType == MapMarkerType.ANCHOR) {
defaultAttr.addDataSeriesCondition(anchorMarkerPane.updateBean());
} else if (markerType == MapMarkerType.COMMON) {
defaultAttr.addDataSeriesCondition(commonMarkerPane.updateBean());
} else if (markerTypeCom.getSelectedIndex() == 2) {
} else if (markerType == MapMarkerType.BUBBLE) {
defaultAttr.addDataSeriesCondition(bubblePane.updateBean());
} else if (markerTypeCom.getSelectedIndex() == 3) {
} else if (markerType == MapMarkerType.IMAGE) {
defaultAttr.addDataSeriesCondition(imageMarkerPane.updateBean());
}
}

3
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapConditionAttrContentPane.java

@ -9,6 +9,7 @@ import com.fr.plugin.chart.type.MapType;
import com.fr.van.chart.designer.other.VanChartConditionAttrContentPane;
import com.fr.van.chart.map.designer.VanMapAreaAndPointGroupPane;
import com.fr.van.chart.map.designer.VanMapAreaPointAndLineGroupPane;
import com.fr.van.chart.map.designer.other.condition.pane.VanChartAnchorPointMapConditionPane;
import com.fr.van.chart.map.designer.other.condition.pane.VanChartBubblePointMapConditionPane;
import com.fr.van.chart.map.designer.other.condition.pane.VanChartCommonPointMapConditionPane;
import com.fr.van.chart.map.designer.other.condition.pane.VanChartDefaultPointMapConditionPane;
@ -99,6 +100,8 @@ public class VanChartMapConditionAttrContentPane extends VanChartConditionAttrCo
private Class<? extends ConditionAttributesPane> getPointMapConditionClassPane(VanChartMapPlot plot) {
MapMarkerType mapMarkerType = plot.getMapMarkerType();
switch (mapMarkerType){
case ANCHOR:
return VanChartAnchorPointMapConditionPane.class;
case COMMON:
return VanChartCommonPointMapConditionPane.class;
case BUBBLE:

42
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/item/VanChartAnchorMarkerConditionPane.java

@ -0,0 +1,42 @@
package com.fr.van.chart.map.designer.other.condition.item;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.van.chart.designer.other.condition.item.AbstractNormalMultiLineConditionPane;
import com.fr.van.chart.map.designer.style.series.VanChartMapAnchorMarkerPane;
import javax.swing.JPanel;
public class VanChartAnchorMarkerConditionPane extends AbstractNormalMultiLineConditionPane {
private VanChartMapAnchorMarkerPane anchorMarkerPane;
public VanChartAnchorMarkerConditionPane(ConditionAttributesPane conditionAttributesPane) {
super(conditionAttributesPane);
}
protected String getItemLabelString() {
return Toolkit.i18nText("Fine-Design_Chart_Marker");
}
protected JPanel initContentPane() {
anchorMarkerPane = new VanChartMapAnchorMarkerPane();
return anchorMarkerPane;
}
public String nameForPopupMenuItem() {
return Toolkit.i18nText("Fine-Design_Chart_Marker");
}
public void populate(DataSeriesCondition condition) {
if (condition instanceof VanChartAttrMarker) {
anchorMarkerPane.populateBean((VanChartAttrMarker) condition);
}
}
public DataSeriesCondition update() {
return anchorMarkerPane.updateBean();
}
}

26
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartAnchorPointMapConditionPane.java

@ -0,0 +1,26 @@
package com.fr.van.chart.map.designer.other.condition.pane;
import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.attr.EffectHelper;
import com.fr.plugin.chart.base.AttrEffect;
import com.fr.plugin.chart.base.AttrFloatColor;
import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.van.chart.designer.other.condition.item.VanChartEffectConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartFloatColorConditionPane;
import com.fr.van.chart.map.designer.other.condition.item.VanChartAnchorMarkerConditionPane;
public class VanChartAnchorPointMapConditionPane extends VanChartMapConditionPane {
public VanChartAnchorPointMapConditionPane(Plot plot) {
super(plot);
}
protected void addDiffAction() {
classPaneMap.put(VanChartAttrMarker.class, new VanChartAnchorMarkerConditionPane(this));
if (addLabelOrEffectAction()) {
addLabelAction();
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getScatterPlotDefaultEffect()));
}
}
}

64
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java

@ -0,0 +1,64 @@
package com.fr.van.chart.map.designer.style.series;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.plugin.chart.marker.type.MarkerType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
public class VanChartMapAnchorMarkerPane extends BasicBeanPane<VanChartAttrMarker> {
private UISpinner anchorSize;
public VanChartMapAnchorMarkerPane() {
anchorSize = new UISpinner(0, Double.MAX_VALUE, 0.1, 12);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Size")), anchorSize}
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] row = {p};
double[] col = {f, e};
JPanel content = TableLayoutHelper.createTableLayoutPane(components, row, col);
content.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER);
this.setLayout(new BorderLayout());
this.add(content, BorderLayout.CENTER);
}
public void populateBean(VanChartAttrMarker marker) {
if (marker == null) {
marker = new VanChartAttrMarker();
}
marker.setCommon(false);
this.anchorSize.setValue(marker.getAnchorSize());
}
public VanChartAttrMarker updateBean() {
VanChartAttrMarker marker = new VanChartAttrMarker();
marker.setCommon(false);
marker.setMarkerType(MarkerType.MARKER_AUTO);
marker.setAnchorSize(this.anchorSize.getValue());
return marker;
}
protected String title4PopupWindow() {
return "anchorMarker";
}
}
Loading…
Cancel
Save