Browse Source

提交开源任务材料

10.0
LAPTOP-SB56SG4Q\86185 3 years ago
parent
commit
a81177cf22
  1. BIN
      JSD-4334-高德地图插件功能设计.docx
  2. 5
      README.md
  3. 28
      plugin.xml
  4. 382
      src/com/fr/plugin/shdcmap/CustomChart.java
  5. 14
      src/com/fr/plugin/shdcmap/CustomChartProvider.java
  6. 42
      src/com/fr/plugin/shdcmap/CustomChartUI.java
  7. 13
      src/com/fr/plugin/shdcmap/CustomLocaleFinder.java
  8. 134
      src/com/fr/plugin/shdcmap/data/CustomDataConfig.java
  9. 79
      src/com/fr/plugin/shdcmap/data/CustomDataPane.java
  10. 73
      src/com/fr/plugin/shdcmap/data/CustomReportDataPane.java
  11. BIN
      src/com/fr/plugin/shdcmap/images/demo.png
  12. BIN
      src/com/fr/plugin/shdcmap/images/icon.png
  13. 50
      src/com/fr/plugin/shdcmap/locale/shdcmap.properties
  14. 50
      src/com/fr/plugin/shdcmap/locale/shdcmap_zh_CN.properties
  15. 164
      src/com/fr/plugin/shdcmap/ui/ChartHyperLinkPane.java
  16. 133
      src/com/fr/plugin/shdcmap/ui/ChartIconListPane.java
  17. 77
      src/com/fr/plugin/shdcmap/ui/CustomChartIconStylePane.java
  18. 77
      src/com/fr/plugin/shdcmap/ui/CustomChartLinkPane.java
  19. 119
      src/com/fr/plugin/shdcmap/ui/CustomChartMapPane.java
  20. 153
      src/com/fr/plugin/shdcmap/ui/CustomChartPointCreator.java
  21. 214
      src/com/fr/plugin/shdcmap/ui/CustomChartTipsPane.java
  22. 30
      src/com/fr/plugin/shdcmap/ui/CustomStylePane.java
  23. 143
      src/com/fr/plugin/shdcmap/ui/ImageChooserPane.java
  24. 42
      src/com/fr/plugin/shdcmap/ui/ImageEntity.java
  25. 94
      src/com/fr/plugin/shdcmap/ui/MapUtil.java
  26. 300
      src/com/fr/plugin/shdcmap/ui/RelationSettingPane.java
  27. 510
      src/com/fr/plugin/shdcmap/web/ShdcGdMapWrapper.js
  28. 110
      样例模板.cpt

BIN
JSD-4334-高德地图插件功能设计.docx

Binary file not shown.

5
README.md

@ -1,3 +1,6 @@
# open-JSD-4334 # open-JSD-4334
JSD-4334 GIS地图集成 JSD-4334 GIS地图集成 \
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\
仅作为开发者学习参考使用!禁止用于任何商业用途!\
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。

28
plugin.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plugin>
<main-package>com.fr.plugin.shdcmap</main-package>
<id>com.fr.plugin.shdcmap.v10</id>
<name><![CDATA[基于高德地图定制]]></name>
<active>yes</active>
<version>1.1</version>
<env-version>10.0</env-version>
<jartime>2020-04-24</jartime>
<vendor>fr.open</vendor>
<description><![CDATA[<p>高德地图功能</p>]]></description>
<change-notes><![CDATA[<p>[2020-12-08]开发1.0版本</p>]]></change-notes>
<extra-report/>
<extra-designer/>
<extra-platform/>
<extra-core>
<LocaleFinder class="com.fr.plugin.shdcmap.CustomLocaleFinder"/>
</extra-core>
<extra-chart>
<IndependentChartProvider class="com.fr.plugin.shdcmap.CustomChartProvider"
plotID="ShdcGdMapChart"/>
</extra-chart>
<extra-chart-designer>
<IndependentChartUIProvider class="com.fr.plugin.shdcmap.CustomChartUI"
plotID="ShdcGdMapChart"/>
</extra-chart-designer>
<function-recorder class="com.fr.plugin.shdcmap.CustomChart"/>
</plugin>

382
src/com/fr/plugin/shdcmap/CustomChart.java

@ -0,0 +1,382 @@
package com.fr.plugin.shdcmap;
import com.fr.chart.chartattr.Chart;
import com.fr.extended.chart.*;
import com.fr.general.ComparatorUtils;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.json.*;
import com.fr.plugin.shdcmap.data.CustomDataConfig;
import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.stable.StringUtils;
import com.fr.stable.web.Repository;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.web.utils.WebUtils;
import java.util.LinkedHashMap;
import java.util.List;
/**
* @author duan.jingliang
*/
@FunctionRecorder
public class CustomChart extends AbstractChart<CustomDataConfig> {
private static final String ID = "ShdcGdMapChart";
private static final String NAME = "基于高德地图定制";
private JSONObject mapConf;
private JSONObject tipsConf;
private JSONArray iconConf;
private NameJavaScriptGroup linkNameGroup;
@Override
protected String getChartID() {
return ID;
}
@Override
public String getChartName() {
return NAME;
}
@ExecuteFunctionRecord
@Override
protected void addJSON(CustomDataConfig dataConfig, JSONObject jsonObject, Repository repository, JSONPara jsonPara) throws JSONException {
jsonObject.put("data", makeChartData(dataConfig));
jsonObject.put("mapConf", getMapConf());
jsonObject.put("iconConf", getIconConf());
jsonObject.put("tipsConf", getTipsConf());
addAutoLinkJSON(jsonObject, repository, jsonPara);
// 联动参数
String centerx = WebUtils.getHTTPRequestParameter(repository.getHttpServletRequest(), "CENTERLNG");
String centery = WebUtils.getHTTPRequestParameter(repository.getHttpServletRequest(), "CENTERLAT");
String mapzoom = WebUtils.getHTTPRequestParameter(repository.getHttpServletRequest(), "MAPZOOM");
JSONObject paramObj = JSONFactory.createJSON(JSON.OBJECT);
paramObj.put("centerx", centerx);
paramObj.put("centery", centery);
paramObj.put("mapzoom", mapzoom);
jsonObject.put("linkParam", paramObj);
}
@Override
protected String[] requiredJS() {
return new String[]{
"com/fr/plugin/shdcmap/web/ShdcGdMapWrapper.js"
};
}
@Override
protected String wrapperName() {
return "ShdcGdMapWrapper";
}
@Override
protected void readAttr(XMLableReader xmLableReader) {
super.readAttr(xmLableReader);
String jsonStr = xmLableReader.getAttrAsString("mapConf", "");
if (StringUtils.isNotEmpty(jsonStr)) {
this.setMapConf(new JSONObject(jsonStr));
}
jsonStr = xmLableReader.getAttrAsString("tipsConf", "");
if (StringUtils.isNotEmpty(jsonStr)) {
this.setTipsConf(new JSONObject(jsonStr));
}
jsonStr = xmLableReader.getAttrAsString("iconConf", "");
if (StringUtils.isNotEmpty(jsonStr)) {
this.setIconConf(new JSONArray(jsonStr));
}
if (null == linkNameGroup) {
linkNameGroup = (NameJavaScriptGroup)xmLableReader.readXMLObject(new NameJavaScriptGroup());
}
}
@Override
protected void writeAttr(XMLPrintWriter xmlPrintWriter) {
super.writeAttr(xmlPrintWriter);
if (null != mapConf) {
xmlPrintWriter.attr("mapConf", mapConf.toString());
}
if (null != tipsConf) {
xmlPrintWriter.attr("tipsConf", tipsConf.toString());
}
if (null != iconConf) {
xmlPrintWriter.attr("iconConf", iconConf.toString());
}
if (null != linkNameGroup) {
linkNameGroup.writeXML(xmlPrintWriter);
}
}
@Override
public boolean equals(Object o) {
return super.equals(o)
&& o instanceof Chart
&& ComparatorUtils.equals(((CustomChart) o).getMapConf(), this.mapConf)
&& ComparatorUtils.equals(((CustomChart) o).getTipsConf(), this.tipsConf)
&& ComparatorUtils.equals(((CustomChart) o).getIconConf(), this.iconConf)
&& ComparatorUtils.equals(((CustomChart) o).getLinkNameGroup(), this.linkNameGroup)
;
}
@Override
public Object clone() throws CloneNotSupportedException {
CustomChart chart = (CustomChart)super.clone();
if (this.linkNameGroup != null) {
chart.setLinkNameGroup((NameJavaScriptGroup) this.getLinkNameGroup().clone());
}
return chart;
}
private void addAutoLinkJSON(JSONObject paramJSONObject, Repository paramRepository, JSONPara paramAbstractChart)
throws JSONException {
ToHyperlinkJSONHelper.addECNameToLinkGroup(paramAbstractChart.ecName, paramAbstractChart.sheetIndex, this.getLinkNameGroup());
paramJSONObject.put("pointLink", ToHyperlinkJSONHelper.addAutoLinkJSON(paramRepository, this.getLinkNameGroup(), hyperLinkParas()));
}
@Override
public NameJavaScriptGroup getHotHyperlink(String s) {
NameJavaScriptGroup retLinkGroup = new NameJavaScriptGroup();
for (int i = 0; i < linkNameGroup.size(); i++) {
NameJavaScript hyperlink = linkNameGroup.getNameHyperlink(i);
String name = hyperlink.getName();
if ("pointLink".equals(s)) {
//if (null != name && name.indexOf("地图点") > 0) {
try {
retLinkGroup.addNameHyperlink((NameJavaScript)hyperlink.clone());
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
//}
}
}
return retLinkGroup;
}
@Override
protected HyperLinkPara[] hyperLinkParas() {
return new HyperLinkPara[]{
new HyperLinkPara() {
@Override
public String getName() {
return "名称";
}
@Override
public String getFormulaContent() {
return "POINTNAME";
}
@Override
public String[] getProps() {
return new String[]{"name"};
}
},
new HyperLinkPara() {
@Override
public String getName() {
return "编码";
}
@Override
public String getFormulaContent() {
return "POINTCODE";
}
@Override
public String[] getProps() {
return new String[]{"code"};
}
}
};
}
@Override
protected List<StringFormula> formulas() {
return null;
}
@Override
protected String demoImagePath() {
return "com/fr/plugin/shdcmap/images/demo.png";
}
private JSONArray makeChartData(CustomDataConfig dataConfig) {
JSONArray dataArr = JSONFactory.createJSON(JSON.ARRAY);
if (null == dataConfig) {
return dataArr;
}
List<Object> code = dataConfig.getCode().getValues();
List<Object> name = dataConfig.getName().getValues();
List<Object> type = dataConfig.getType().getValues();
List<Object> icon = dataConfig.getIcon().getValues();
List<Object> lng = dataConfig.getCoords().getValues();
List<Object> convert = dataConfig.getConvert().getValues();
List<Object> customNames = dataConfig.getCustomNameField().getValues();
List<Object> customValues = dataConfig.getCustomValueField().getValues();
LinkedHashMap singleDataMap = new LinkedHashMap();
if (dataConfig.isCustomName() && dataConfig.getCustomFields().size() > 0) {
List customFields = dataConfig.getCustomFields();
int recordNum = ((ExtendedField)customFields.get(0)).getValues().size();
for (int i = 0; i < recordNum; i++) {
Object codeval = code.get(i);
Object nameval = name.get(i);
Object typeval = type.get(i);
Object iconval = icon.get(i);
Object lngval = lng.get(i);
Object convertval = convert.get(i);
String key = codeval + "*" + nameval + "*" + typeval + "*" + iconval;
JSONObject jsonObject = (JSONObject)singleDataMap.get(key);
if (null == jsonObject) {
jsonObject = JSONFactory.createJSON(JSON.OBJECT);
jsonObject.put("code", codeval);
jsonObject.put("name", nameval);
jsonObject.put("type", typeval);
jsonObject.put("icon", iconval);
jsonObject.put("coords", lngval);
jsonObject.put("convert", convertval);
jsonObject.put("customName", JSONFactory.createJSON(JSON.ARRAY));
jsonObject.put("customValue", JSONFactory.createJSON(JSON.ARRAY));
dataArr.put(jsonObject);
}
for (int k = 0; k < customFields.size(); k++) {
ExtendedField field = (ExtendedField)customFields.get(k);
String customName = field.getCustomName();
List<Object> values = field.getValues();
//jsonObject.put(customName, values.get(i));
jsonObject.getJSONArray("customName").put(customName);
jsonObject.getJSONArray("customValue").put(values.get(i));
}
}
} else if (!dataConfig.isCustomName() && customNames.size() > 0 && customValues.size() > 0) {
for (int i = 0; i < code.size(); i++) {
Object codeval = code.get(i);
Object nameval = name.get(i);
Object typeval = type.get(i);
Object iconval = icon.get(i);
Object lngval = lng.get(i);
Object convertval = convert.get(i);
String key = codeval + "*" + nameval + "*" + typeval + "*" + iconval;
JSONObject jsonObject = (JSONObject)singleDataMap.get(key);
if (null == jsonObject) {
jsonObject = JSONFactory.createJSON(JSON.OBJECT);
jsonObject.put("code", codeval);
jsonObject.put("name", nameval);
jsonObject.put("type", typeval);
jsonObject.put("icon", iconval);
jsonObject.put("coords", lngval);
jsonObject.put("convert", convertval);
jsonObject.put("customName", JSONFactory.createJSON(JSON.ARRAY));
jsonObject.put("customValue", JSONFactory.createJSON(JSON.ARRAY));
dataArr.put(jsonObject);
}
jsonObject.getJSONArray("customName").put(customNames.get(i));
jsonObject.getJSONArray("customValue").put(customValues.get(i));
//jsonObject.put((String)customNames.get(i), customValues.get(i));
}
} else {
for (int i = 0; i < code.size(); i++) {
JSONObject dataObj = JSONFactory.createJSON(JSON.OBJECT);
dataObj.put("code", code.get(i));
dataObj.put("name", name.get(i));
dataObj.put("type", type.get(i));
dataObj.put("icon", icon.get(i));
dataObj.put("coords", lng.get(i));
dataObj.put("convert", convert.get(i));
dataArr.put(dataObj);
}
}
return dataArr;
}
public NameJavaScriptGroup getLinkNameGroup() {
return linkNameGroup;
}
public void setLinkNameGroup(NameJavaScriptGroup linkNameGroup) {
this.linkNameGroup = linkNameGroup;
}
public JSONObject getMapConf() {
if (null == mapConf) {
mapConf = new JSONObject();
mapConf.put("mapzoom", 10);
mapConf.put("centerx", "121.474488");
mapConf.put("centery", "31.233588");
mapConf.put("mapStyle", "d82836f41b8b6f6123697c763867a5b1");
mapConf.put("showGovRegion", false);
}
return mapConf;
}
public void setMapConf(JSONObject mapConf) {
this.mapConf = mapConf;
}
public JSONObject getTipsConf() {
if (null == tipsConf) {
tipsConf = new JSONObject();
tipsConf.put("showtips", true);
tipsConf.put("tipbgcolor", "#000000");
tipsConf.put("tipcolor", "#ffffff");
tipsConf.put("tipdesc", true);
tipsConf.put("tipfamily", "微软雅黑");
tipsConf.put("tipcode", true);
tipsConf.put("tippoint", true);
tipsConf.put("tipother", true);
tipsConf.put("tipsize", 11);
tipsConf.put("tipstyle", 1);
tipsConf.put("tiptransparent", 60);
tipsConf.put("tiptype", 1);
tipsConf.put("tipJsPane", "console.log(this);");
tipsConf.put("tipbgwidth", 200);
}
return tipsConf;
}
public void setTipsConf(JSONObject tipsConf) {
this.tipsConf = tipsConf;
}
public JSONArray getIconConf() {
if (null == iconConf) {
iconConf = new JSONArray();
JSONObject attr = new JSONObject();
attr.put("fillColor", "#00ccff");
attr.put("fillOpacity", 60);
attr.put("lineColor", "#fc6600");
attr.put("lineWidth", 1);
attr.put("pointSize", 16);
attr.put("pointimg", "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABNklEQVR4nGNgwAa2/Ndh2PQ/nWHT30UQDGSDxAiCVf8lgBrmMGz69x87BsqB1GAFG/824NaIhkFqUcDm/6o4FF8H4rsMG/99wJAD6UEyYBOqDf92AMU6Gdb/MgDLb/rbCBRbjWbAJqjmnxpopu+HG7zp31OgQjdgIFZj9SZIL8PG/zFIgp+AiquAms4D6a9AWw8BxfbCDdj0twXVpUC9QEnkUL8MUfjbHuwShPhPIH4DDavLCHGgXhQDNv67A1QUAhS7B6R/IRnwg2Hbf3aot26gGoDqBVDgzIU6txoq9pdh8z+QYc+BcpdRXAb2AkYg/u+HGAD096b/PkCxK4hA/bsYMxCxRePm/8sZNv+thxpkARRbD/TeKuzRiCshgRIPKEw2/ruJNZGhJCSKkzJVMhMyICE7AwCn/eHxoKNCTAAAAABJRU5ErkJggg==");
attr.put("pointimgtype", "png");
attr.put("pointimgh", 16);
attr.put("pointimgw", 16);
attr.put("titleName", "图标1");
iconConf.put(attr);
}
return iconConf;
}
public void setIconConf(JSONArray iconConf) {
this.iconConf = iconConf;
}
}

14
src/com/fr/plugin/shdcmap/CustomChartProvider.java

@ -0,0 +1,14 @@
package com.fr.plugin.shdcmap;
import com.fr.extended.chart.AbstractChart;
import com.fr.extended.chart.AbstractExtentChartProvider;
/**
* @author duan.jingliang
*/
public class CustomChartProvider extends AbstractExtentChartProvider {
@Override
protected AbstractChart createChart() {
return new CustomChart();
}
}

42
src/com/fr/plugin/shdcmap/CustomChartUI.java

@ -0,0 +1,42 @@
package com.fr.plugin.shdcmap;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.extended.chart.AbstractExtendedChartTableDataPane;
import com.fr.extended.chart.AbstractExtendedChartUIProvider;
import com.fr.plugin.shdcmap.data.CustomDataPane;
import com.fr.plugin.shdcmap.data.CustomReportDataPane;
import com.fr.plugin.shdcmap.ui.CustomStylePane;
/**
* @author duan.jingliang
*/
public class CustomChartUI extends AbstractExtendedChartUIProvider {
@Override
protected AbstractExtendedChartTableDataPane getTableDataSourcePane() {
return new CustomDataPane();
}
@Override
protected AbstractReportDataContentPane getReportDataSourcePane() {
return new CustomReportDataPane();
}
@Override
public String[] getDemoImagePath() {
return new String[0];
}
@Override
public String getIconPath() {
return "com/fr/plugin/shdcmap/images/icon.png";
}
@Override
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener attributeChangeListener) {
return new AbstractChartAttrPane[]{
new CustomStylePane(attributeChangeListener)
};
}
}

13
src/com/fr/plugin/shdcmap/CustomLocaleFinder.java

@ -0,0 +1,13 @@
package com.fr.plugin.shdcmap;
import com.fr.stable.fun.impl.AbstractLocaleFinder;
/**
* @author duan.jingliang
*/
public class CustomLocaleFinder extends AbstractLocaleFinder {
@Override
public String find() {
return "com/fr/plugin/shdcmap/locale/shdcmap";
}
}

134
src/com/fr/plugin/shdcmap/data/CustomDataConfig.java

@ -0,0 +1,134 @@
package com.fr.plugin.shdcmap.data;
import com.fr.extended.chart.AbstractDataConfig;
import com.fr.extended.chart.ExtendedField;
import com.fr.stable.AssistUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
/**
* @author duan.jingliang
* @date 2020/11/13
*/
public class CustomDataConfig extends AbstractDataConfig {
private ExtendedField code = new ExtendedField();
private ExtendedField name = new ExtendedField();
private ExtendedField type = new ExtendedField();
private ExtendedField icon = new ExtendedField();
private ExtendedField coords = new ExtendedField();
private ExtendedField convert = new ExtendedField();
@Override
protected void readAttr(XMLableReader xmLableReader) {
readExtendedField(code, "code", xmLableReader);
readExtendedField(name, "name", xmLableReader);
readExtendedField(type, "type", xmLableReader);
readExtendedField(icon, "icon", xmLableReader);
readExtendedField(coords, "coords", xmLableReader);
readExtendedField(convert, "convert", xmLableReader);
}
@Override
protected void writeAttr(XMLPrintWriter xmlPrintWriter) {
writeExtendedField(code, "code", xmlPrintWriter);
writeExtendedField(name, "name", xmlPrintWriter);
writeExtendedField(type, "type", xmlPrintWriter);
writeExtendedField(icon, "icon", xmlPrintWriter);
writeExtendedField(coords, "coords", xmlPrintWriter);
writeExtendedField(convert, "convert", xmlPrintWriter);
}
@Override
public ExtendedField[] dataSetFields() {
return new ExtendedField[]{
code,
name,
type,
icon,
coords,
convert
};
}
@Override
public CustomDataConfig clone() throws CloneNotSupportedException {
CustomDataConfig result = new CustomDataConfig();
result.setCode(this.getCode().clone());
result.setName(this.getName().clone());
result.setType(this.getType().clone());
result.setIcon(this.getIcon().clone());
result.setCoords(this.getCoords().clone());
result.setConvert(this.getConvert().clone());
return result;
}
@Override
public int hashCode() {
return super.hashCode() + AssistUtils.hashCode(this.getCode(),this.getName(),this.getType(),this.getIcon(),this.getCoords(),this.getConvert());
}
@Override
public boolean equals(Object obj) {
return obj instanceof CustomDataConfig
&& AssistUtils.equals(this.getCode(), ((CustomDataConfig) obj).getCode())
&& AssistUtils.equals(this.getName(), ((CustomDataConfig) obj).getName())
&& AssistUtils.equals(this.getType(), ((CustomDataConfig) obj).getType())
&& AssistUtils.equals(this.getIcon(), ((CustomDataConfig) obj).getIcon())
&& AssistUtils.equals(this.getCoords(), ((CustomDataConfig) obj).getCoords())
&& AssistUtils.equals(this.getConvert(), ((CustomDataConfig) obj).getConvert())
&& AssistUtils.equals(this.getCustomFields(), ((CustomDataConfig) obj).getCustomFields())
&& AssistUtils.equals(this.getCustomNameField(), ((CustomDataConfig) obj).getCustomNameField())
&& AssistUtils.equals(this.getCustomValueField(), ((CustomDataConfig) obj).getCustomValueField())
;
}
public ExtendedField getName() {
return name;
}
public void setName(ExtendedField name) {
this.name = name;
}
public ExtendedField getType() {
return type;
}
public void setType(ExtendedField type) {
this.type = type;
}
public ExtendedField getIcon() {
return icon;
}
public void setIcon(ExtendedField icon) {
this.icon = icon;
}
public ExtendedField getCode() {
return code;
}
public void setCode(ExtendedField code) {
this.code = code;
}
public ExtendedField getCoords() {
return coords;
}
public void setCoords(ExtendedField coords) {
this.coords = coords;
}
public ExtendedField getConvert() {
return convert;
}
public void setConvert(ExtendedField convert) {
this.convert = convert;
}
}

79
src/com/fr/plugin/shdcmap/data/CustomDataPane.java

@ -0,0 +1,79 @@
package com.fr.plugin.shdcmap.data;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.extended.chart.AbstractExtendedChartTableDataPane;
import com.fr.extended.chart.ExtendedCustomFieldComboBoxPane;
/**
* @author duan.jingliang
* @date 2020/11/18
*/
public class CustomDataPane extends AbstractExtendedChartTableDataPane<CustomDataConfig> {
private UIComboBox code;
private UIComboBox name;
private UIComboBox type;
private UIComboBox icon;
private UIComboBox coords;
private UIComboBox convert;
@Override
protected ExtendedCustomFieldComboBoxPane createExtendedCustomFieldComboBoxPane() {
return new ExtendedCustomFieldComboBoxPane(){
@Override
protected boolean valueComboBoxHasNone() {
return true;
}
};
}
@Override
protected String[] fieldLabels() {
return new String[]{
Toolkit.i18nText("Plugin-ShdcMap_code"),
Toolkit.i18nText("Plugin-ShdcMap_name"),
Toolkit.i18nText("Plugin-ShdcMap_type"),
Toolkit.i18nText("Plugin-ShdcMap_icon"),
Toolkit.i18nText("Plugin-ShdcMap_coords"),
Toolkit.i18nText("Plugin-ShdcMap_convert")
};
}
@Override
protected UIComboBox[] filedComboBoxes() {
if (null == code) {
code = new UIComboBox();
name = new UIComboBox();
type = new UIComboBox();
icon = new UIComboBox();
coords = new UIComboBox();
convert = new UIComboBox();
}
return new UIComboBox[]{
code, name, type, icon, coords, convert
};
}
@Override
protected void populate(CustomDataConfig dataConfig) {
populateField(code, dataConfig.getCode());
populateField(name, dataConfig.getName());
populateField(type, dataConfig.getType());
populateField(icon, dataConfig.getIcon());
populateField(coords, dataConfig.getCoords());
populateField(convert, dataConfig.getConvert());
}
@Override
protected CustomDataConfig update() {
CustomDataConfig dataConfig = new CustomDataConfig();
updateField(code, dataConfig.getCode());
updateField(name, dataConfig.getName());
updateField(type, dataConfig.getType());
updateField(icon, dataConfig.getIcon());
updateField(coords, dataConfig.getCoords());
updateField(convert, dataConfig.getConvert());
return dataConfig;
}
}

73
src/com/fr/plugin/shdcmap/data/CustomReportDataPane.java

@ -0,0 +1,73 @@
package com.fr.plugin.shdcmap.data;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.i18n.Toolkit;
import com.fr.extended.chart.AbstractExtendedChartReportDataPane;
/**
* @author duan.jingliang
* @date 2020/11/16
*/
public class CustomReportDataPane extends AbstractExtendedChartReportDataPane<CustomDataConfig> {
private TinyFormulaPane code;
private TinyFormulaPane name;
private TinyFormulaPane type;
private TinyFormulaPane icon;
private TinyFormulaPane coords;
private TinyFormulaPane convert;
@Override
protected boolean hasCustomFieldPane() {
return true;
}
@Override
protected String[] fieldLabel() {
return new String[]{
Toolkit.i18nText("Plugin-ShdcMap_code"),
Toolkit.i18nText("Plugin-ShdcMap_name"),
Toolkit.i18nText("Plugin-ShdcMap_type"),
Toolkit.i18nText("Plugin-ShdcMap_icon"),
Toolkit.i18nText("Plugin-ShdcMap_coords"),
Toolkit.i18nText("Plugin-ShdcMap_convert")
};
}
@Override
protected TinyFormulaPane[] formulaPanes() {
if (null == code) {
code = new TinyFormulaPane();
name = new TinyFormulaPane();
type = new TinyFormulaPane();
icon = new TinyFormulaPane();
coords = new TinyFormulaPane();
convert = new TinyFormulaPane();
}
return new TinyFormulaPane[]{
code, name, type, icon, coords, convert
};
}
@Override
protected void populate(CustomDataConfig dataConfig) {
populateField(code, dataConfig.getCode());
populateField(name, dataConfig.getName());
populateField(type, dataConfig.getType());
populateField(icon, dataConfig.getIcon());
populateField(coords, dataConfig.getCoords());
populateField(convert, dataConfig.getConvert());
}
@Override
protected CustomDataConfig update() {
CustomDataConfig dataConfig = new CustomDataConfig();
updateField(code, dataConfig.getCode());
updateField(name, dataConfig.getName());
updateField(type, dataConfig.getType());
updateField(icon, dataConfig.getIcon());
updateField(coords, dataConfig.getCoords());
updateField(convert, dataConfig.getConvert());
return dataConfig;
}
}

BIN
src/com/fr/plugin/shdcmap/images/demo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
src/com/fr/plugin/shdcmap/images/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

50
src/com/fr/plugin/shdcmap/locale/shdcmap.properties

@ -0,0 +1,50 @@
Plugin-ShdcMap_code=\u7F16\u7801
Plugin-ShdcMap_name=\u540D\u79F0
Plugin-ShdcMap_type=\u573A\u666F
Plugin-ShdcMap_icon=\u7C7B\u578B
Plugin-ShdcMap_lng=\u7ECF\u5EA6
Plugin-ShdcMap_lat=\u7EAC\u5EA6
Plugin-ShdcMap_coords=\u7ECF\u7EAC\u5EA6
Plugin-ShdcMap_convert=\u5750\u6807\u8F6C\u6362
Plugin-ShdcMap-icontitle=\u56FE\u6807
Plugin-ShdcMap-maptitle=\u5730\u56FE
Plugin-ShdcMap-mapzoom=\u5730\u56FE\u7EA7\u522B
Plugin-ShdcMap-centerx=\u4E2D\u5FC3\u70B9\u7ECF\u5EA6
Plugin-ShdcMap-centery=\u4E2D\u5FC3\u70B9\u7EAC\u5EA6
Plugin-ShdcMap-mapStyle=\u5730\u56FE\u6837\u5F0F
Plugin-ShdcMap-RegionExpand=\u5730\u56FE\u914D\u7F6E
Plugin-ShdcMap-tipstitle=\u63D0\u793A\u6846
Plugin-ShdcMap-showtips=\u663E\u793A\u63D0\u793A
Plugin-ShdcMap-tipbgcolor=\u63D0\u793A\u80CC\u666F\u8272
Plugin-ShdcMap-tiptransparent=\u80CC\u666F\u900F\u660E\u5EA6
Plugin-ShdcMap-PointTipExpand=\u63D0\u793A
Plugin-ShdcMap-tipbgwidth=\u63D0\u793A\u6846\u5BBD\u5EA6
Plugin-ShdcMap-labelTypeCheck=\u9009\u9879
Plugin-ShdcMap-labelTypeJS=JavaScript
Plugin-ShdcMap-tipcode=\u663E\u793A\u7F16\u7801
Plugin-ShdcMap-tippoint=\u663E\u793A\u540D\u79F0
Plugin-ShdcMap-tiplng=\u663E\u793A\u7ECF\u5EA6
Plugin-ShdcMap-tiplat=\u663E\u793A\u7EAC\u5EA6
Plugin-ShdcMap-tipother=\u663E\u793A\u5176\u4ED6
Plugin-ShdcMap-TipConentExpand=\u63D0\u793A\u5185\u5BB9
Plugin-ShdcMap-linktitle=\u8D85\u7EA7\u94FE\u63A5
Plugin-ShdcMap-pointSize=\u56FE\u6807\u5927\u5C0F
Plugin-ShdcMap-lineWidth=\u533A\u57DF\u8FB9\u6846\u5BBD\u5EA6
Plugin-ShdcMap-lineColor=\u533A\u57DF\u8FB9\u6846\u989C\u8272
Plugin-ShdcMap-fillColor=\u533A\u57DF\u586B\u5145\u8272
Plugin-ShdcMap-fillOpacity=\u533A\u57DF\u4E0D\u900F\u660E\u5EA6
Plugin-ShdcMap-iconSymbolExpand=\u56FE\u6807\u6837\u5F0F
Plugin-ShdcMap-regionSymbolExpand=\u533A\u57DF\u6837\u5F0F
Plugin-ShdcMap-tiptype=\u5185\u5BB9\u6765\u6E90
Plugin-ShdcMap-showGovRegion=\u542F\u7528\u884C\u653F\u533A\u57DF
Plugin-ShdcMap-showSateLayer=\u542F\u7528\u536B\u661F\u56FE\u5C42

50
src/com/fr/plugin/shdcmap/locale/shdcmap_zh_CN.properties

@ -0,0 +1,50 @@
Plugin-ShdcMap_code=\u7F16\u7801
Plugin-ShdcMap_name=\u540D\u79F0
Plugin-ShdcMap_type=\u573A\u666F
Plugin-ShdcMap_icon=\u7C7B\u578B
Plugin-ShdcMap_lng=\u7ECF\u5EA6
Plugin-ShdcMap_lat=\u7EAC\u5EA6
Plugin-ShdcMap_coords=\u7ECF\u7EAC\u5EA6
Plugin-ShdcMap_convert=\u5750\u6807\u8F6C\u6362
Plugin-ShdcMap-icontitle=\u56FE\u6807
Plugin-ShdcMap-maptitle=\u5730\u56FE
Plugin-ShdcMap-mapzoom=\u5730\u56FE\u7EA7\u522B
Plugin-ShdcMap-centerx=\u4E2D\u5FC3\u70B9\u7ECF\u5EA6
Plugin-ShdcMap-centery=\u4E2D\u5FC3\u70B9\u7EAC\u5EA6
Plugin-ShdcMap-mapStyle=\u5730\u56FE\u6837\u5F0F
Plugin-ShdcMap-RegionExpand=\u5730\u56FE\u914D\u7F6E
Plugin-ShdcMap-tipstitle=\u63D0\u793A\u6846
Plugin-ShdcMap-showtips=\u663E\u793A\u63D0\u793A
Plugin-ShdcMap-tipbgcolor=\u63D0\u793A\u80CC\u666F\u8272
Plugin-ShdcMap-tiptransparent=\u80CC\u666F\u900F\u660E\u5EA6
Plugin-ShdcMap-PointTipExpand=\u63D0\u793A
Plugin-ShdcMap-tipbgwidth=\u63D0\u793A\u6846\u5BBD\u5EA6
Plugin-ShdcMap-labelTypeCheck=\u9009\u9879
Plugin-ShdcMap-labelTypeJS=JavaScript
Plugin-ShdcMap-tipcode=\u663E\u793A\u7F16\u7801
Plugin-ShdcMap-tippoint=\u663E\u793A\u540D\u79F0
Plugin-ShdcMap-tiplng=\u663E\u793A\u7ECF\u5EA6
Plugin-ShdcMap-tiplat=\u663E\u793A\u7EAC\u5EA6
Plugin-ShdcMap-tipother=\u663E\u793A\u5176\u4ED6
Plugin-ShdcMap-TipConentExpand=\u63D0\u793A\u5185\u5BB9
Plugin-ShdcMap-linktitle=\u8D85\u7EA7\u94FE\u63A5
Plugin-ShdcMap-pointSize=\u56FE\u6807\u5927\u5C0F
Plugin-ShdcMap-lineWidth=\u533A\u57DF\u8FB9\u6846\u5BBD\u5EA6
Plugin-ShdcMap-lineColor=\u533A\u57DF\u8FB9\u6846\u989C\u8272
Plugin-ShdcMap-fillColor=\u533A\u57DF\u586B\u5145\u8272
Plugin-ShdcMap-fillOpacity=\u533A\u57DF\u4E0D\u900F\u660E\u5EA6
Plugin-ShdcMap-iconSymbolExpand=\u56FE\u6807\u6837\u5F0F
Plugin-ShdcMap-regionSymbolExpand=\u533A\u57DF\u6837\u5F0F
Plugin-ShdcMap-tiptype=\u5185\u5BB9\u6765\u6E90
Plugin-ShdcMap-showGovRegion=\u542F\u7528\u884C\u653F\u533A\u57DF
Plugin-ShdcMap-showSateLayer=\u542F\u7528\u536B\u661F\u56FE\u5C42

164
src/com/fr/plugin/shdcmap/ui/ChartHyperLinkPane.java

@ -0,0 +1,164 @@
package com.fr.plugin.shdcmap.ui;
import com.fr.base.BaseFormula;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.web.ChartHyperRelateFloatLink;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.extended.chart.HyperLinkPara;
import com.fr.form.main.FormHyperlink;
import com.fr.general.NameObject;
import com.fr.js.*;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.shdcmap.CustomChart;
import com.fr.stable.ListMap;
import com.fr.stable.Nameable;
import com.fr.van.chart.designer.component.VanChartUIListControlPane;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* @author duan.jingliang
*/
public class ChartHyperLinkPane extends VanChartUIListControlPane {
private CustomChart shdcChart;
public ChartHyperLinkPane() {
}
@Override
protected void update(Plot plot) {
}
public void populateHyperLink(CustomChart chart) {
this.shdcChart = chart;
NameJavaScriptGroup njsg = chart.getLinkNameGroup();
HashMap hyperlinkMap = getHyperlinkMap();
ArrayList noList = new ArrayList();
for(int i = 0; njsg != null && i < njsg.size(); i++) {
NameJavaScript njs = njsg.getNameHyperlink(i);
if (njs != null && njs.getJavaScript() != null) {
JavaScript js = njs.getJavaScript();
UIMenuNameableCreator var11 = new UIMenuNameableCreator(njs.getName(), js, this.getUseMap(hyperlinkMap, js.getClass()));
noList.add(new NameObject(var11.getName(), var11.getObj()));
}
}
this.populate((Nameable[])noList.toArray(new NameObject[noList.size()]));
this.doLayout();
}
public void updateHyperLink(CustomChart chart) {
Nameable[] nameables = this.update();
NameJavaScriptGroup njsg = new NameJavaScriptGroup();
njsg.clear();
for (int i = 0; i < nameables.length; i++) {
JavaScript noObj = (JavaScript)((NameObject)nameables[i]).getObject();
String noName = nameables[i].getName();
NameJavaScript njs = new NameJavaScript(noName, noObj);
njsg.addNameHyperlink(njs);
}
chart.setLinkNameGroup(njsg);
}
@Override
public NameableCreator[] createNameableCreators() {
ListMap creatorMap = new ListMap();
NameableCreator[] chartHyperLinkCreators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators();
NameableCreator creator;
for(int i = 0; i < chartHyperLinkCreators.length; i++) {
creator = chartHyperLinkCreators[i];
NameObjectCreator noc = (NameObjectCreator)creator;
if ("图表超链-联动悬浮元素".equals(creator.menuName())) {
creatorMap.put(creator.menuName(), creator);
}
if ("当前决策报表对象".equals(creator.menuName())) {
creatorMap.put(creator.menuName(), creator);
}
if ("JavaScript脚本".equals(creator.menuName())) {
NameableCreator newCreatorPoint = new NameObjectCreator(creator.menuName(), JavaScriptImpl.class, JavaScriptImplPane.class);
creatorMap.put(creator.menuName(), newCreatorPoint);
}
}
return (NameableCreator[])creatorMap.values().toArray(new NameableCreator[creatorMap.size()]);
}
@Override
protected String title4PopupWindow() {
return "添加链接";
}
@Override
protected String getAddItemText() {
return "添加链接";
}
protected Map<String, BaseFormula> getHyperLinkEditorMap() {
return shdcChart.getHyperLinkEditorMap();
}
@Override
public BasicBeanPane createPaneByCreators(NameableCreator nameableCreator) {
Constructor var2 = null;
try {
var2 = nameableCreator.getUpdatePane().getConstructor(HashMap.class, Boolean.TYPE);
return (BasicBeanPane)var2.newInstance(this.getHyperLinkEditorMap(), false);
} catch (InstantiationException var4) {
FineLoggerFactory.getLogger().error(var4.getMessage(), var4);
} catch (IllegalAccessException var5) {
FineLoggerFactory.getLogger().error(var5.getMessage(), var5);
} catch (NoSuchMethodException var6) {
return super.createPaneByCreators(nameableCreator);
} catch (InvocationTargetException var7) {
FineLoggerFactory.getLogger().error(var7.getMessage(), var7);
}
return null;
}
protected HashMap getHyperlinkMap() {
HashMap var2 = new HashMap(10);
var2.put(ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.class);
var2.put(FormHyperlinkProvider.class, FormHyperlinkPane.class);
var2.put(JavaScriptImplPane.class, JavaScriptImplPane.class);
return var2;
}
protected Class<? extends BasicBeanPane> getUseMap(HashMap var1, Object var2) {
if (var1.get(var2) != null) {
return (Class)var1.get(var2);
} else {
Iterator var3 = var1.keySet().iterator();
Object var4;
do {
if (!var3.hasNext()) {
return null;
}
var4 = var3.next();
} while(!((Class)var4).isAssignableFrom((Class)var2));
return (Class)var1.get(var4);
}
}
}

133
src/com/fr/plugin/shdcmap/ui/ChartIconListPane.java

@ -0,0 +1,133 @@
package com.fr.plugin.shdcmap.ui;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.general.NameObject;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.shdcmap.CustomChart;
import com.fr.stable.ListMap;
import com.fr.stable.Nameable;
import com.fr.van.chart.designer.component.VanChartUIListControlPane;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
/**
* @author duan.jingliang
*/
public class ChartIconListPane extends VanChartUIListControlPane {
private CustomChart chart;
public ChartIconListPane() {
}
@Override
protected void update(Plot plot) {
}
public void populateStyle(CustomChart chart) {
this.chart = chart;
JSONArray iconConf = chart.getIconConf();
HashMap hyperlinkMap = getHyperlinkMap();
ArrayList noList = new ArrayList();
for (int i = 0; null != iconConf && i < iconConf.size(); i++) {
JSONObject icon = iconConf.getJSONObject(i);
if (null != icon) {
UIMenuNameableCreator var11 = new UIMenuNameableCreator(icon.getString("titleName"), icon, this.getUseMap(hyperlinkMap, JSONObject.class));
noList.add(new NameObject(var11.getName(), var11.getObj()));
}
}
this.populate((Nameable[])noList.toArray(new NameObject[noList.size()]));
this.doLayout();
}
public void updateStyle(CustomChart chart) {
Nameable[] nameables = this.update();
JSONArray iconConf = JSONArray.create();
for (int i = 0; i < nameables.length; i++) {
JSONObject noObj = (JSONObject)((NameObject)nameables[i]).getObject();
if (null == noObj) {
noObj = JSONObject.create();
}
noObj.put("titleName", ((NameObject)nameables[i]).getName());
iconConf.add(noObj);
}
chart.setIconConf(iconConf);
}
@Override
public NameableCreator[] createNameableCreators() {
ListMap creatorMap = new ListMap();
NameableCreator newCreatorPoint = new NameObjectCreator("标注类型", JSONObject.class, CustomChartPointCreator.class);
creatorMap.put(newCreatorPoint.menuName(), newCreatorPoint);
return (NameableCreator[])creatorMap.values().toArray(new NameableCreator[creatorMap.size()]);
}
@Override
protected String title4PopupWindow() {
return "添加图标";
}
@Override
protected String getAddItemText() {
return "添加图标";
}
@Override
public BasicBeanPane createPaneByCreators(NameableCreator nameableCreator) {
Constructor var2 = null;
try {
var2 = nameableCreator.getUpdatePane().getConstructor();
return (BasicBeanPane)var2.newInstance();
} catch (InstantiationException var4) {
FineLoggerFactory.getLogger().error(var4.getMessage(), var4);
} catch (IllegalAccessException var5) {
FineLoggerFactory.getLogger().error(var5.getMessage(), var5);
} catch (NoSuchMethodException var6) {
return super.createPaneByCreators(nameableCreator);
} catch (InvocationTargetException var7) {
FineLoggerFactory.getLogger().error(var7.getMessage(), var7);
}
return null;
}
protected HashMap getHyperlinkMap() {
HashMap var2 = new HashMap(10);
var2.put(JSONObject.class, CustomChartPointCreator.class);
return var2;
}
protected Class<? extends BasicBeanPane> getUseMap(HashMap var1, Object var2) {
if (var1.get(var2) != null) {
return (Class)var1.get(var2);
} else {
Iterator var3 = var1.keySet().iterator();
Object var4;
do {
if (!var3.hasNext()) {
return null;
}
var4 = var3.next();
} while(!((Class)var4).isAssignableFrom((Class)var2));
return (Class)var1.get(var4);
}
}
}

77
src/com/fr/plugin/shdcmap/ui/CustomChartIconStylePane.java

@ -0,0 +1,77 @@
package com.fr.plugin.shdcmap.ui;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.plugin.shdcmap.CustomChart;
import javax.swing.*;
import java.awt.*;
/**
* @author duan.jingliang
*/
public class CustomChartIconStylePane extends ExtendedScrollPane<CustomChart> {
private ChartIconListPane hyperLinkPane;
@Override
protected JPanel createContentPane() {
return new ContentPane();
}
@Override
public void populateBean(CustomChart chart) {
hyperLinkPane.populateStyle(chart);
}
@Override
public void updateBean(CustomChart chart) {
hyperLinkPane.updateStyle(chart);
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-ShdcMap-icontitle");
}
private class ContentPane extends JPanel {
public ContentPane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
// 链接
JPanel linkContentPane = createLinkContentPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p};
Component[][] acomponents = new Component[][]{
new Component[]{linkContentPane}
} ;
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents,rowSize,columnSize);
this.add(panel,BorderLayout.CENTER);
this.setVisible(true);
}
}
private JPanel createLinkContentPane(){
hyperLinkPane = new ChartIconListPane();
Component[][] comps = new Component[][]{
new Component[]{null},
new Component[]{hyperLinkPane}
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
JPanel panel = TableLayoutHelper.createTableLayoutPane(comps, new double[]{p, p}, new double[]{f});
return panel;
}
}

77
src/com/fr/plugin/shdcmap/ui/CustomChartLinkPane.java

@ -0,0 +1,77 @@
package com.fr.plugin.shdcmap.ui;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.plugin.shdcmap.CustomChart;
import javax.swing.*;
import java.awt.*;
/**
* @author duan.jingliang
*/
public class CustomChartLinkPane extends ExtendedScrollPane<CustomChart> {
private ChartHyperLinkPane hyperLinkPane;
@Override
protected JPanel createContentPane() {
return new ContentPane();
}
@Override
public void populateBean(CustomChart chart) {
hyperLinkPane.populateHyperLink(chart);
}
@Override
public void updateBean(CustomChart chart) {
hyperLinkPane.updateHyperLink(chart);
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-ShdcMap-linktitle");
}
private class ContentPane extends JPanel {
public ContentPane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
// 链接
JPanel linkContentPane = createLinkContentPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p};
Component[][] acomponents = new Component[][]{
new Component[]{linkContentPane}
} ;
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents,rowSize,columnSize);
this.add(panel,BorderLayout.CENTER);
this.setVisible(true);
}
}
private JPanel createLinkContentPane(){
hyperLinkPane = new ChartHyperLinkPane();
Component[][] comps = new Component[][]{
new Component[]{null},
new Component[]{hyperLinkPane}
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
JPanel panel = TableLayoutHelper.createTableLayoutPane(comps, new double[]{p, p}, new double[]{f});
return panel;
}
}

119
src/com/fr/plugin/shdcmap/ui/CustomChartMapPane.java

@ -0,0 +1,119 @@
package com.fr.plugin.shdcmap.ui;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.json.JSONObject;
import com.fr.plugin.shdcmap.CustomChart;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.*;
import java.awt.*;
/**
* @author duan.jingliang
*/
public class CustomChartMapPane extends ExtendedScrollPane<CustomChart> {
private UISpinner mapzoom;
private UITextField centerx;
private UITextField centery;
private UITextField mapStyle;
private UICheckBox showGovRegion;
private UICheckBox showSateLayer;
@Override
protected JPanel createContentPane() {
return new ContentPane();
}
@Override
public void populateBean(CustomChart chart) {
JSONObject regionConf = chart.getMapConf();
this.mapzoom.setValue(regionConf.getDouble("mapzoom"));
this.centerx.setText(regionConf.getString("centerx"));
this.centery.setText(regionConf.getString("centery"));
this.mapStyle.setText(regionConf.getString("mapStyle"));
this.showGovRegion.setSelected(regionConf.getBoolean("showGovRegion"));
this.showSateLayer.setSelected(regionConf.getBoolean("showSateLayer"));
}
@Override
public void updateBean(CustomChart chart) {
JSONObject regionConf = JSONObject.create();
regionConf.put("mapzoom", this.mapzoom.getValue());
regionConf.put("centerx", this.centerx.getText());
regionConf.put("centery", this.centery.getText());
regionConf.put("mapStyle", this.mapStyle.getText());
regionConf.put("showGovRegion", this.showGovRegion.isSelected());
regionConf.put("showSateLayer", this.showSateLayer.isSelected());
chart.setMapConf(regionConf);
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-ShdcMap-maptitle");
}
private class ContentPane extends JPanel {
public ContentPane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
JPanel regionContentPane = createRegionContentPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p};
Component[][] acomponents = new Component[][]{
new Component[]{regionContentPane}
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents,rowSize,columnSize);
this.add(panel,BorderLayout.CENTER);
this.setVisible(true);
}
}
private JPanel createRegionContentPane(){
mapzoom = new UISpinner(1, 18, 1, 1);
centerx = new UITextField();
centery = new UITextField();
mapStyle = new UITextField();
showGovRegion = new UICheckBox(Toolkit.i18nText("Plugin-ShdcMap-showGovRegion"));
showSateLayer = new UICheckBox(Toolkit.i18nText("Plugin-ShdcMap-showSateLayer"));
Component[][] components = new Component[][]{
{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-mapzoom")), this.mapzoom},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-centerx")), this.centerx},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-centery")), this.centery},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-mapStyle")), this.mapStyle},
new Component[]{null, showGovRegion},
new Component[]{null, showSateLayer}
} ;
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-ShdcMap-RegionExpand"), components);
}
}

153
src/com/fr/plugin/shdcmap/ui/CustomChartPointCreator.java

@ -0,0 +1,153 @@
package com.fr.plugin.shdcmap.ui;
import com.fr.chart.base.TextAttr;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.FRFont;
import com.fr.json.JSONObject;
import com.fr.van.chart.designer.AbstractVanChartScrollPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
/**
* @author duan.jingliang
*/
public class CustomChartPointCreator extends AbstractVanChartScrollPane<JSONObject> {
private ImageChooserPane pointPane;
private UISpinner pointSize;
private UISpinner lineWidth;
private ColorSelectBox lineColor;
private ColorSelectBox fillColor;
private UINumberDragPane fillOpacity;
@Override
protected JPanel createContentPane() {
return new ContentPane();
}
@Override
public void populateBean(JSONObject pointConf) {
if (null != pointConf) {
pointSize.setValue(pointConf.getDouble("pointSize"));
ImageEntity imgEnt = new ImageEntity();
imgEnt.setImagestr(pointConf.getString("pointimg"));
imgEnt.setImagetype(pointConf.getString("pointimgtype"));
imgEnt.setWidth(pointConf.getInt("pointimgw"));
imgEnt.setHeight(pointConf.getInt("pointimgh"));
this.pointPane.populateBean(imgEnt);
this.lineWidth.setValue(pointConf.getDouble("lineWidth"));
this.lineColor.setSelectObject(MapUtil.toColor(pointConf.getString("lineColor")));
this.fillColor.setSelectObject(MapUtil.toColor(pointConf.getString("fillColor")));
this.fillOpacity.populateBean(pointConf.getDouble("fillOpacity"));
}
}
@Override
public JSONObject updateBean() {
JSONObject pointConf = JSONObject.create();
pointConf.put("pointSize", pointSize.getValue());
ImageEntity imgEnt = this.pointPane.updateBean();
if (null != imgEnt) {
pointConf.put("pointimg", imgEnt.getImagestr());
pointConf.put("pointimgtype", imgEnt.getImagetype());
pointConf.put("pointimgw", imgEnt.getWidth());
pointConf.put("pointimgh", imgEnt.getHeight());
}
pointConf.put("lineWidth", this.lineWidth.getValue());
pointConf.put("lineColor", MapUtil.toHex(this.lineColor.getSelectObject()));
pointConf.put("fillColor", MapUtil.toHex(this.fillColor.getSelectObject()));
pointConf.put("fillOpacity", this.fillOpacity.updateBean());
return pointConf;
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-ShdcMap-icontitle");
}
private class ContentPane extends JPanel {
public ContentPane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
JPanel pointPane = createPointPane();
JPanel regionPane = createRegionPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p, p};
Component[][] acomponents = new Component[][]{
new Component[]{pointPane},
new Component[]{regionPane}
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize);
this.add(panel, BorderLayout.CENTER);
this.setVisible(true);
}
}
private JPanel createPointPane() {
pointSize = new UISpinner(1, 200, 1, 80);
pointPane = new ImageChooserPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
Component[][] components = new Component[][]{
{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-pointSize")), this.pointSize}
};
JPanel sizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{p, f});
Component[][] comp1 = new Component[][]{
new Component[]{sizePane},
new Component[]{pointPane}
};
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, new double[]{p, p, p}, new double[]{f});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-ShdcMap-iconSymbolExpand"), pane);
}
private JPanel createRegionPane() {
this.lineWidth = new UISpinner(1, 10, 1, 1);
this.lineColor = new ColorSelectBox(100);
this.fillColor = new ColorSelectBox(100);
this.fillOpacity = new UINumberDragPane(0, 100);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
Component[][] comps = new Component[][]{
{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-lineWidth")), this.lineWidth},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-lineColor")), this.lineColor},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-fillColor")), this.fillColor},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-fillOpacity")), this.fillOpacity}
};
JPanel regionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p, p, p}, new double[]{p, f});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-ShdcMap-regionSymbolExpand"), regionPane);
}
}

214
src/com/fr/plugin/shdcmap/ui/CustomChartTipsPane.java

@ -0,0 +1,214 @@
package com.fr.plugin.shdcmap.ui;
import com.fr.chart.base.TextAttr;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.general.FRFont;
import com.fr.json.JSONObject;
import com.fr.plugin.shdcmap.CustomChart;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
/**
* @author duan.jingliang
*/
public class CustomChartTipsPane extends ExtendedScrollPane<CustomChart> {
private UICheckBox showtips;
private ColorSelectBox tipbgcolor;
private UINumberDragPane tiptransparent;
private ChartTextAttrPane tipTextAttrPane;
private UISpinner tipbgwidth;
private UICheckBox tipcode;
private UICheckBox tippoint;
private UICheckBox tipother;
private UIButtonGroup<Integer> tiptype;
private UITextArea tipJsPane;
private CardLayout tipCardLayout;
@Override
protected JPanel createContentPane() {
return new ContentPane();
}
@Override
public void populateBean(CustomChart chart) {
JSONObject tipsConf = chart.getTipsConf();
showtips.setSelected(tipsConf.getBoolean("showtips"));
tipbgcolor.setSelectObject(MapUtil.toColor(tipsConf.getString("tipbgcolor")));
tiptransparent.populateBean(tipsConf.getDouble("tiptransparent"));
FRFont tipFont = FRFont.getInstance(tipsConf.getString("tipfamily"),
tipsConf.getInt("tipstyle"),
tipsConf.getInt("tipsize"),
MapUtil.toColor(tipsConf.getString("tipcolor")));
tipTextAttrPane.populate(tipFont);
tipbgwidth.setValue(tipsConf.getDouble("tipbgwidth"));
tipcode.setSelected(tipsConf.getBoolean("tipcode"));
tippoint.setSelected(tipsConf.getBoolean("tippoint"));
tipother.setSelected(tipsConf.getBoolean("tipother"));
tiptype.setSelectedItem(tipsConf.getInt("tiptype"));
tipJsPane.setText(tipsConf.getString("tipJsPane"));
}
@Override
public void updateBean(CustomChart chart) {
JSONObject tipsConf = JSONObject.create();
tipsConf.put("showtips", showtips.isSelected());
tipsConf.put("tipbgcolor", MapUtil.toHex(tipbgcolor.getSelectObject()));
tipsConf.put("tiptransparent", tiptransparent.updateBean());
TextAttr tipText = this.tipTextAttrPane.update();
tipsConf.put("tipsize", tipText.getFRFont().getSize());
tipsConf.put("tipstyle", tipText.getFRFont().getStyle());
tipsConf.put("tipfamily", tipText.getFRFont().getFamily());
tipsConf.put("tipcolor", MapUtil.toHex(tipText.getFRFont().getForeground()));
tipsConf.put("tipbgwidth", tipbgwidth.getValue());
tipsConf.put("tipcode", tipcode.isSelected());
tipsConf.put("tippoint", tippoint.isSelected());
tipsConf.put("tipother", tipother.isSelected());
tipsConf.put("tiptype", tiptype.getSelectedItem());
tipsConf.put("tipJsPane", tipJsPane.getText());
chart.setTipsConf(tipsConf);
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-ShdcMap-tipstitle");
}
private class ContentPane extends JPanel {
public ContentPane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
JPanel tipPane = createTipStylePane();
JPanel tipContentPane = createTipContentPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p};
Component[][] acomponents = new Component[][]{
new Component[]{tipPane},
new Component[]{tipContentPane}
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize);
this.add(panel, BorderLayout.CENTER);
this.setVisible(true);
}
}
private JPanel createTipStylePane() {
showtips = new UICheckBox(Toolkit.i18nText("Plugin-ShdcMap-showtips"));
tipbgcolor = new ColorSelectBox(100);
tiptransparent = new UINumberDragPane(0.0, 100.0);
tipTextAttrPane = new ChartTextAttrPane();
tipbgwidth = new UISpinner(0.0, 1000.0, 1.0, 200.0);
Component[][] comp1 = new Component[][]{
{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-tipbgwidth")), this.tipbgwidth},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-tipbgcolor")), this.tipbgcolor},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-tiptransparent")), this.tiptransparent}
};
double p = TableLayout.PREFERRED;
double[] columnSize = {TableLayout.PREFERRED, TableLayout.FILL};
double[] rowSize = {p, p, p, p, p};
JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, rowSize, columnSize);
Component[][] comp2 = new Component[][]{
new Component[]{this.showtips},
new Component[]{panel1},
new Component[]{tipTextAttrPane}
};
JPanel panel2 = TableLayoutHelper.createTableLayoutPane(comp2, new double[]{p, p, p}, new double[]{TableLayout.FILL});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-ShdcMap-PointTipExpand"), panel2);
}
private JPanel createTipContentPane() {
tiptype = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Plugin-ShdcMap-labelTypeCheck"), Toolkit.i18nText("Plugin-ShdcMap-labelTypeJS")}, new Integer[]{1,2});
//tiptype.setSelectedItem(1);
tipcode = new UICheckBox(Toolkit.i18nText("Plugin-ShdcMap-tipcode"));
tippoint = new UICheckBox(Toolkit.i18nText("Plugin-ShdcMap-tippoint"));
tipother = new UICheckBox(Toolkit.i18nText("Plugin-ShdcMap-tipother"));
tipJsPane = new UITextArea(10, 6);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
Component[][] compCheck = new Component[][]{
new Component[]{null, tipcode},
new Component[]{null, tippoint},
new Component[]{null, tipother}
};
final JPanel checkPane = TableLayout4VanChartHelper.createGapTableLayoutPane(compCheck, new double[]{p, p, p, p, p}, new double[]{p, f});
final JPanel cardPane = new JPanel(this.tipCardLayout = new CardLayout()){
@Override
public Dimension getPreferredSize() {
if (null != tiptype.getSelectedItem() && tiptype.getSelectedItem() == 2) {
return tipJsPane.getPreferredSize();
} else {
return checkPane.getPreferredSize();
}
}
};
cardPane.add(checkPane, "check");
cardPane.add(tipJsPane, "js");
this.tipCardLayout.show(cardPane, "check");
tiptype.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent var1x) {
if (tiptype.getSelectedItem() == 1) {
tipCardLayout.show(cardPane, "check");
} else {
tipCardLayout.show(cardPane, "js");
}
}
});
Component[][] compLabel = new Component[][]{
{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-tiptype")), this.tiptype}
};
JPanel labelTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(compLabel, new double[]{p, p}, new double[]{p, f});
Component[][] comp1 = new Component[][]{
new Component[]{labelTypePane},
new Component[]{cardPane}
};
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, new double[]{p, p, p}, new double[]{f});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-ShdcMap-TipConentExpand"), pane);
}
}

30
src/com/fr/plugin/shdcmap/ui/CustomStylePane.java

@ -0,0 +1,30 @@
package com.fr.plugin.shdcmap.ui;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.extended.chart.AbstractExtendedStylePane;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.plugin.shdcmap.CustomChart;
import java.util.ArrayList;
import java.util.List;
/**
* @author duan.jingliang
*/
public class CustomStylePane extends AbstractExtendedStylePane<CustomChart> {
public CustomStylePane(){
super();
}
public CustomStylePane(AttributeChangeListener attributeChangeListener){
super(attributeChangeListener);
}
@Override
protected List<ExtendedScrollPane<CustomChart>> initPaneList() {
List<ExtendedScrollPane<CustomChart>> list = new ArrayList<ExtendedScrollPane<CustomChart>>();
list.add(new CustomChartMapPane());
list.add(new CustomChartIconStylePane());
list.add(new CustomChartTipsPane());
list.add(new CustomChartLinkPane());
return list;
}
}

143
src/com/fr/plugin/shdcmap/ui/ImageChooserPane.java

@ -0,0 +1,143 @@
package com.fr.plugin.shdcmap.ui;
import com.bulenkov.iconloader.util.Base64Converter;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.utils.ImageUtils;
import com.fr.general.ImageWithSuffix;
import com.fr.general.xml.GeneralXMLTools;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
public class ImageChooserPane extends BasicBeanPane<ImageEntity> {
private ImageFileChooser imageChooser;
private ImagePreviewPane imagePreview;
private UIButton imagebtn;
private ImageEntity imageEntity;
private CustomStylePane stylePane;
public ImageChooserPane(){
this.setLayout(new BorderLayout());
imagePreview = new ImagePreviewPane();
imageEntity = new ImageEntity();
imagebtn = new UIButton("选择图标");
UILabel imageLab = new UILabel("点图标");
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p, p};
Component[][] acomponents = new Component[][]{
new Component[]{imageLab, imagebtn},
new Component[]{null, imagePreview}
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents,rowSize,columnSize);
this.add(panel, BorderLayout.CENTER);
this.setVisible(true);
imageChooser = new ImageFileChooser();
imageChooser.setMultiSelectionEnabled(false);
initLiseners();
}
private void initLiseners() {
this.imagebtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int returnVal = imageChooser.showOpenDialog(ImageChooserPane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
dealWithImageFile();
if (null != ImageChooserPane.this.stylePane) {
ImageChooserPane.this.stylePane.attributeChanged();
}
}
}
});
}
private void dealWithImageFile() {
final File selectedFile = imageChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
BufferedImage image = BaseUtils.readImage(selectedFile.getPath());
if (null == image) {
return;
}
if (image.getWidth() > 300 || image.getHeight() > 300) {
JOptionPane.showMessageDialog(null,
"图片太大,请重新选择!大小不超过300*300,当前尺寸:" + image.getWidth() + "*" + image.getHeight(),
"信息提示",
JOptionPane.ERROR_MESSAGE);
return;
}
String type = ImageUtils.getImageType(selectedFile);
String iconBase64 = Base64Converter.encode(GeneralXMLTools.imageEncode(image, type));
if (null == this.imageEntity) {
this.imageEntity = new ImageEntity();
}
this.imageEntity.setImagestr(iconBase64);
this.imageEntity.setImagetype(type);
this.imageEntity.setWidth(image.getWidth());
this.imageEntity.setHeight(image.getHeight());
if (imagePreview != null) {
ImageWithSuffix imageWithSuffix = new ImageWithSuffix(image, type);
imagePreview.setImageStyle(Style.getInstance());
imagePreview.setImageWithSuffix(imageWithSuffix);
imagePreview.repaint();
}
}
}
@Override
public void populateBean(ImageEntity ob) {
if (null == ob || null == ob.getImagestr() || "".equals(ob.getImagestr())) {
this.imageEntity = new ImageEntity();
this.imagePreview.setImage(null);
this.imagePreview.repaint();
new ImagePreviewPane();
return;
}
this.imageEntity = ob;
BufferedImage image = (BufferedImage)GeneralXMLTools.imageDecode(Base64Converter.decode(ob.getImagestr().getBytes()));
if (imagePreview != null && null != image) {
ImageWithSuffix imageWithSuffix = new ImageWithSuffix(image, ob.getImagetype());
imagePreview.setImageStyle(Style.getInstance());
imagePreview.setImageWithSuffix(imageWithSuffix);
imagePreview.repaint();
}
}
@Override
public ImageEntity updateBean() {
return this.imageEntity;
}
@Override
protected String title4PopupWindow() {
return "点图标设置";
}
public void setStylePane(CustomStylePane stylePane) {
this.stylePane = stylePane;
}
}

42
src/com/fr/plugin/shdcmap/ui/ImageEntity.java

@ -0,0 +1,42 @@
package com.fr.plugin.shdcmap.ui;
import java.io.Serializable;
public class ImageEntity implements Serializable {
private String imagestr;
private String imagetype;
private int width;
private int height;
public String getImagestr() {
return imagestr;
}
public void setImagestr(String imagestr) {
this.imagestr = imagestr;
}
public String getImagetype() {
return imagetype;
}
public void setImagetype(String imagetype) {
this.imagetype = imagetype;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
}

94
src/com/fr/plugin/shdcmap/ui/MapUtil.java

@ -0,0 +1,94 @@
package com.fr.plugin.shdcmap.ui;
import java.awt.*;
import java.util.Map;
/**
* @author duan.jingliang
*/
public class MapUtil {
public static String getString(Map map, String key) {
return getString(map, key, null);
}
public static String getString(Map map, String key, String def) {
if (null == map) {
return def;
}
if (null != map.get(key)) {
return map.get(key).toString();
} else {
return def;
}
}
public static Integer getInteger(Map map, String key) {
return getInteger(map, key, null);
}
public static Integer getInteger(Map map, String key, Integer def) {
if (null == map) {
return def;
}
if (null != map.get(key)) {
return Integer.parseInt(map.get(key).toString());
} else {
return def;
}
}
public static Double getDouble(Map map, String key) {
return getDouble(map, key, null);
}
public static Double getDouble(Map map, String key, Double def) {
if (null == map) {
return def;
}
if (null != map.get(key)) {
return Double.parseDouble(map.get(key).toString());
} else {
return def;
}
}
public static Boolean getBoolean(Map map, String key) {
return getBoolean(map, key, null);
}
public static Boolean getBoolean(Map map, String key, Boolean def) {
if (null == map) {
return def;
}
String s = getString(map, key);
if (null != s) {
if ("true".equals(s)) {
return true;
} else if ("false".equals(s)){
return false;
} else {
return def;
}
} else {
return def;
}
}
public static String toHex(Color c) {
if (null == c) {
return "transparent";
}
String hex = Integer.toHexString(c.getRGB());
if (hex.length() == 8) {
hex = "#" + hex.substring(2);
}
return hex;
}
public static Color toColor(String c) {
if (null != c && c.startsWith("#")) {
c = c.substring(1);
return new Color(Integer.parseInt(c, 16));
}
return null;
}
}

300
src/com/fr/plugin/shdcmap/ui/RelationSettingPane.java

@ -0,0 +1,300 @@
package com.fr.plugin.shdcmap.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.scrollruler.ModLineBorder;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.ColorUIResource;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
/**
* @author duan.jingliang
* @create 2019/9/6
* 设计器配置界面
* 配置父格关系公式关系死循环关系的功能开关及样式配置
*/
public class RelationSettingPane extends BasicBeanPane<String> {
private static final ColorUIResource BORDER_COLOR = new ColorUIResource(168, 172, 180);
private static final Border TIP_BORDER = BorderFactory.createEmptyBorder(10, 4, 4, 4);
private static final Border DIALOG_BORDER = BorderFactory.createEmptyBorder(0, 6, 4, 6);
private static final Border INNER_LEFT_BORDER = BorderFactory.createEmptyBorder(15, 35, 15, 0);
private UICheckBox formulaCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_Formula"), true);
private UICheckBox parentCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_Parent"), true);
private UICheckBox leftParentCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_Left_Parent"), true);
private UICheckBox topParentCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_Top_Paren"), true);
private UISpinner parentCount = new UISpinner(1, 20, 1, 5);
private final double p = TableLayout.PREFERRED;
private final double f = TableLayout.FILL;
private final String checkedValue = "1";
private final String uncheckedValue = "0";
private ColorSelectBox parentBgColor = new ColorSelectBox(100);
private ColorSelectBox parentTextColor = new ColorSelectBox(100);;
private ColorSelectBox formulaBgColor = new ColorSelectBox(100);
private ColorSelectBox formulaTextColor = new ColorSelectBox(100);
private UICheckBox endlessLoopCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_Endless_Loop"), true);
private ColorSelectBox endlessLoopColor = new ColorSelectBox(100);
public RelationSettingPane() {
setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel titleLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_Explain"));
titleLabel.setBorder(TIP_BORDER);
add(titleLabel, "North");
UIScrollPane detailScrollPane = new UIScrollPane(initDetailPane());
detailScrollPane.setBorder(new MatteBorder(1, 1, 1, 1, BORDER_COLOR));
add(detailScrollPane, "Center");
setBorder(DIALOG_BORDER);
checkEndlessEnabled();
}
@Override
public void populateBean(String o) {
}
@Override
public String updateBean() {
return "hello";
}
private JPanel initDetailPane() {
UILabel outerBorder = new UILabel("");
outerBorder.setBorder(INNER_LEFT_BORDER);
// 父格关系设置面板
JPanel parentSettingPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
parentSettingPanel.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(1), com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_Parent_Group")));
JPanel parentSettingCompsPanel = getParentSettingCompsPanel();
parentSettingCompsPanel.setBorder(INNER_LEFT_BORDER);
parentSettingPanel.add(parentSettingCompsPanel);
// 公式关系设置面板
JPanel formulaSettingPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(1, 2, 2);
formulaSettingPanel.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(1), com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_Formula_Group")));
JPanel formulaSettingCompsPanel = getFormulaSettingCompsPanel();
formulaSettingCompsPanel.setBorder(INNER_LEFT_BORDER);
formulaSettingPanel.add(formulaSettingCompsPanel);
// 死循环设置面板
JPanel endlessLoopSettingPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(1, 2, 2);
endlessLoopSettingPanel.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(1), com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_EndlessLoop_Group")));
JPanel endlessLoopSettingCompsPanel = getEndlessLoopSettingCompsPanel();
endlessLoopSettingCompsPanel.setBorder(INNER_LEFT_BORDER);
endlessLoopSettingPanel.add(endlessLoopSettingCompsPanel);
Component[][] arrayOfComponent = {{outerBorder}, {parentSettingPanel}, {formulaSettingPanel}, {endlessLoopSettingPanel}};
return TableLayoutHelper.createGapTableLayoutPane(arrayOfComponent, new double[]{p, p, p, p}, new double[]{p},1.0D, 1.0D);
}
protected JPanel getParentSettingCompsPanel() {
//this.parentCount.setValue(Integer.valueOf(RelationSetting.getInstance().getParentCount()));
if (uncheckedValue.equals(0)) {
this.parentCheckBox.setSelected(false);
this.parentCount.setEnabled(false);
this.leftParentCheckBox.setSelected(false);
this.leftParentCheckBox.setEnabled(false);
this.topParentCheckBox.setSelected(false);
this.topParentCheckBox.setEnabled(false);
}
String parentBgColorStr = ""; //RelationSetting.getInstance().get("parentBgColor");
String parentTextColorStr = ""; //RelationSetting.getInstance().get("parentTextColor");
if (StringUtils.isNotEmpty(parentBgColorStr)) {
this.parentBgColor.setSelectObject(MapUtil.toColor(parentBgColorStr));
} else {
this.parentBgColor.setSelectObject(MapUtil.toColor("#00ccff"));
}
if (StringUtils.isNotEmpty(parentTextColorStr)) {
this.parentTextColor.setSelectObject(MapUtil.toColor(parentTextColorStr));
} else {
this.parentTextColor.setSelectObject(MapUtil.toColor("#ffffff"));
}
this.parentCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent paramAnonymousChangeEvent) {
if (RelationSettingPane.this.parentCheckBox.isSelected()) {
RelationSettingPane.this.parentCount.setEnabled(true);
RelationSettingPane.this.leftParentCheckBox.setEnabled(true);
RelationSettingPane.this.topParentCheckBox.setEnabled(true);
} else {
RelationSettingPane.this.parentCount.setEnabled(false);
RelationSettingPane.this.leftParentCheckBox.setSelected(false);
RelationSettingPane.this.leftParentCheckBox.setEnabled(false);
RelationSettingPane.this.topParentCheckBox.setSelected(false);
RelationSettingPane.this.topParentCheckBox.setEnabled(false);
}
RelationSettingPane.this.checkEndlessEnabled();
}
});
Component[][] settingComps = {
{this.parentCheckBox, null},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_ParentCount") + ":", 4), this.parentCount},
{this.leftParentCheckBox, this.topParentCheckBox}
};
JPanel settingPane = TableLayoutHelper.createGapTableLayoutPane(settingComps, new double[]{p, p, p}, new double[]{p, p}, 6.0D, 6.0D);
Component[][] styleComps = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_ParentStyle_BgColor")),
this.parentBgColor,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_ParentStyle_TextColor")),
this.parentTextColor
}
};
JPanel stylePane = TableLayoutHelper.createGapTableLayoutPane(styleComps, new double[]{p}, new double[]{p, p, p, p}, 6.0D, 6.0D);
Component[][] comps = new Component[][]{
{settingPane},
{stylePane}
};
return TableLayoutHelper.createGapTableLayoutPane(comps, new double[]{p, p}, new double[]{p}, 6.0D, 6.0D);
}
private JPanel getFormulaSettingCompsPanel() {
String formulaBgColorStr = ""; // = RelationSetting.getInstance().get("formulaBgColor");
if (StringUtils.isNotEmpty(formulaBgColorStr)) {
this.formulaBgColor.setSelectObject(MapUtil.toColor(formulaBgColorStr));
} else {
this.formulaBgColor.setSelectObject(MapUtil.toColor("#00ccff"));
}
String formulaTextColorStr = ""; //RelationSetting.getInstance().get("formulaTextColor");
if (StringUtils.isNotEmpty(formulaTextColorStr)) {
this.formulaTextColor.setSelectObject(MapUtil.toColor(formulaTextColorStr));
} else {
this.formulaTextColor.setSelectObject(MapUtil.toColor("#ffffff"));
}
this.formulaCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
RelationSettingPane.this.checkEndlessEnabled();
}
});
Component[][] settingComps = new Component[][]{
new Component[]{this.formulaCheckBox, null}
};
JPanel settingPane = TableLayoutHelper.createGapTableLayoutPane(settingComps, new double[]{p}, new double[]{p, p}, 6.0D, 6.0D);
Component[][] styleComps = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_ParentStyle_BgColor")),
this.formulaBgColor,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_ParentStyle_TextColor")),
this.formulaTextColor
}
};
JPanel stylePane = TableLayoutHelper.createGapTableLayoutPane(styleComps, new double[]{p}, new double[]{p, p, p, p}, 6.0D, 6.0D);
Component[][] comps = new Component[][]{
{settingPane},
{stylePane}
};
return TableLayoutHelper.createGapTableLayoutPane(comps, new double[]{p, p}, new double[]{p}, 6.0D, 6.0D);
}
private JPanel getEndlessLoopSettingCompsPanel() {
Component[][] components = new Component[][]{
new Component[]{this.endlessLoopCheckBox, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_ParentStyle_EndLoopColor")), this.endlessLoopColor}
};
return TableLayoutHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{p, p}, 6.0D, 6.0D);
}
public void doWithProcess() {
//RelationSetting.getInstance().saveRelationSetting(getParentSwitch(), getLeftParentSwitch(), getTopParentSwitch(), getParentCount(), getFormulaSwitch());
Map<String, String> confMap = new HashMap(10);
confMap.put("parentBgColor", MapUtil.toHex(this.parentBgColor.getSelectObject()));
confMap.put("parentTextColor", MapUtil.toHex(this.parentTextColor.getSelectObject()));
confMap.put("formulaBgColor", MapUtil.toHex(this.formulaBgColor.getSelectObject()));
confMap.put("formulaTextColor", MapUtil.toHex(this.formulaTextColor.getSelectObject()));
confMap.put("endlessLoop", getEndlessLoopSwitch());
confMap.put("endlessLoopColor", MapUtil.toHex(this.endlessLoopColor.getSelectObject()));
//RelationSetting.getInstance().saveRelationSetting(confMap);
}
private void checkEndlessEnabled() {
if (!this.parentCheckBox.isSelected() && !this.formulaCheckBox.isSelected()) {
this.endlessLoopCheckBox.setEnabled(false);
this.endlessLoopColor.setEnabled(false);
} else {
this.endlessLoopCheckBox.setEnabled(true);
this.endlessLoopColor.setEnabled(true);
}
}
private String getEndlessLoopSwitch() {
String str = "0";
if (this.endlessLoopCheckBox.isSelected()) {
str = "1";
}
return str;
}
private int getParentCount() {
Double countDouble = this.parentCount.getValue();
return countDouble.intValue();
}
private String getParentSwitch() {
String str = "0";
boolean isOpenSwitch = (this.parentCheckBox.isSelected()) && ((this.topParentCheckBox.isSelected()) || (this.leftParentCheckBox.isSelected()));
if (isOpenSwitch) {
str = "1";
}
return str;
}
private String getTopParentSwitch() {
String str = "0";
if (this.topParentCheckBox.isSelected()) {
str = "1";
}
return str;
}
private String getLeftParentSwitch() {
String str = "0";
if (this.leftParentCheckBox.isSelected()) {
str = "1";
}
return str;
}
private String getFormulaSwitch() {
String str = "0";
if (this.formulaCheckBox.isSelected()) {
str = "1";
}
return str;
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Relation_Setting_Name");
}
}

510
src/com/fr/plugin/shdcmap/web/ShdcGdMapWrapper.js

@ -0,0 +1,510 @@
ShdcGdMapWrapper = ExtendedChart.extend({
_init: function (dom, option) {
debugger;
var self = this;
self.chartBaseOption = option;
this._dom = dom;
this.width = option.width || $(dom).width();// 补充从dom获取.
this.height = option.height || $(dom).height();
this.loadMapNum = 0;
this.chartData = option.data;
this.mapConf = option.mapConf;
this.iconConf = option.iconConf;
this.tipsConf = option.tipsConf;
this.pointLink = option.pointLink;
this.linkParam = option.linkParam;
this.initTips();
this.initMaps();
return {};
},
initTips: function() {
var self = this;
$('<div></div>').css({
'position': 'absolute',
'left': '0px',
'top': '0px',
'width': (self.tipsConf.tipbgwidth || 200) + 'px',
'padding': '10px',
'background-color': self.hexToRgba(self.tipsConf.tipbgcolor, self.tipsConf.tiptransparent).rgba,
'border-radius': '5px',
'color': self.tipsConf.tipcolor,
'font-size': self.tipsConf.tipsize,
'font-family': self.tipsConf.tipfamily,
'font-style': self.getFontStyle(self.tipsConf.tipstyle),
'font-weight': self.getFontWeight(self.tipsConf.tipstyle)
}).addClass('ShdcAMap_custom_tips').appendTo($(this._dom).parent());
$(this._dom).parent().find('div.ShdcAMap_custom_tips').hide();
},
initMaps: function() {
var self = this;
var mapUrl = "https://webapi.amap.com/maps?v=1.4.15&key=96a69f5b479081b2de6ce05669b60578&plugin=Map3D,AMap.DistrictLayer,AMap.Scale,AMap.ToolBar";
$.getScript(mapUrl,function(){
var mapStyleId = self.mapConf.mapStyle || "d82836f41b8b6f6123697c763867a5b1";
var centerx = self.linkParam.centerx || self.mapConf.centerx || 121.485950661;
var centery = self.linkParam.centery || self.mapConf.centery || 31.730548215;
var mapzoom = self.linkParam.mapzoom || self.mapConf.mapzoom || 13;
var map = new AMap.Map(self._dom, {
resizeEnable: true,
center: [centerx, centery],
zoom: mapzoom,
mapStyle: 'amap://styles/' + mapStyleId
});
self.baseMap = map;
if (self.mapConf.showGovRegion) {
self.initGovRegion();
}
if (self.mapConf.showSateLayer) {
var satellite = new AMap.TileLayer.Satellite();
map.add(satellite);
}
self.loadRsPoint();
});
},
initGovRegion: function(){
var self = this;
//var regionStyle = self.getGovRegionStyle();
self.disProvince = new AMap.DistrictLayer.Province({
zIndex: 1,
adcode: "310000",
depth: 5,
styles: {
'fill': function (properties) {
// properties为可用于做样式映射的字段,包含
// NAME_CHN:中文名称
// adcode_pro
// adcode_cit
// adcode
console.log(properties.NAME_CHN);
var styleAttr = self.getGovRegionStyle(properties.NAME_CHN);
return self.hexToRgba(styleAttr.fillColor, styleAttr.fillOpacity).rgba;
},
'province-stroke': function(properties){
return self.getGovRegionStyle(properties.NAME_CHN).lineColor;
},
'city-stroke': function(properties){
return self.getGovRegionStyle(properties.NAME_CHN).lineColor;
}, // 中国地级市边界
'county-stroke': function(properties){
//'rgba(255,255,255,0.5)' // 中国区县边界
return self.getGovRegionStyle(properties.NAME_CHN).lineColor;
}
}
});
self.disProvince.setMap(self.baseMap);
},
getGovRegionStyle: function(region){
var self = this;
var iconAttr = {};
var isSetStyle = false;
for (var i = 0; i < self.iconConf.length; i++) {
if (region == self.iconConf[i].titleName) {
iconAttr = self.iconConf[i];
isSetStyle = true;
break;
}
}
if (isSetStyle) {
return iconAttr;
} else {
var gb = Math.random() * 155 + 50;
var randomColor = 'rgba(' + gb + ',' + gb + ',255,0.8)';
return {
lineWidth: 0,
lineColor: 'rgba(255,255,255,0)',
fillColor: randomColor,
fillOpacity: 0,
};
}
},
calImgSize: function(imgw, imgh, size) {
if (size && size > 0) {
if (imgw > imgh) {
imgh = size * imgh / imgw;
imgw = size;
} else {
imgw = size * imgw / imgh;
imgh = size;
}
}
return {
imgw: imgw,
imgh: imgh
};
},
_customDoLink: function(params) {
params.linkKey = params.linkKey || 'pointLink';
var hyperLink = this.pointLink;
if (params && hyperLink && hyperLink.parasMap) {
params.chartIndex = this.chartIndex || 0;
this._doLinkWithFilter(params, hyperLink);
}
},
loadRsPoint: function() {
var self = this;
this.rsPointMaps = {};
this.chartData.map(function (item) {
self.rsPointMaps[item.code] = item;
var lnglatArr = self.lnglatToArr(item.coords);
// 转换经纬度
if (item.convert == "是") {
self.coordsConvert(lnglatArr, item);
} else {
var showCoords = [];
lnglatArr.map(function(e){
showCoords.push(new AMap.LngLat(e[0], e[1]));
});
self.loadIcon(item, showCoords);
}
/*AMap.convertFrom(lnglatArr, 'gps', function (status, result) {
if (result.info === 'ok') {
var aLnglatArr = result.locations;
self.loadIcon(item, aLnglatArr);
}
});*/
});
},
coordsConvert: function(LngLatArray, item) {
var self = this;
var LngLatArray2 = [];
var size = 40;
var pageNum = parseInt((LngLatArray.length + size - 1) / size);
var convertNum = 0;
var convert = function(LngLatArraySlice, n) {
AMap.convertFrom(LngLatArraySlice, 'gps', function (status, result) {
if (result.info === 'ok') {
LngLatArray2[n] = (result.locations);
convertNum++;
if (convertNum >= pageNum) {
self.loadIcon(item, [].concat.apply([], LngLatArray2));
}
}
});
};
for (var i = 0; i < pageNum; i++) {
var LngLatArraySlice = LngLatArray.slice(i * size, (i + 1) * size);
convert(LngLatArraySlice, i);
}
},
loadIcon: function(data, lnglat) {
var self = this;
var iconAttr = {};
for (var i = 0; i < self.iconConf.length; i++) {
if (data.icon == self.iconConf[i].titleName) {
iconAttr = self.iconConf[i];
break;
}
}
if (data.type == "点" || data.type == "组合") {
var realImgSize = self.calImgSize(iconAttr.pointimgw, iconAttr.pointimgh, iconAttr.pointSize);
iconAttr.pointimgw = realImgSize.imgw;
iconAttr.pointimgh = realImgSize.imgh;
var imgstr = 'data:image/' + iconAttr.pointimgtype + ';base64,' + iconAttr.pointimg;
var icon = new AMap.Icon({
size: new AMap.Size(iconAttr.pointimgw, iconAttr.pointimgh),
image: imgstr,
imageSize: new AMap.Size(iconAttr.pointimgw, iconAttr.pointimgh)
});
var markerPos = lnglat[0];
if (data.type == "组合") {
markerPos = self.getAreaCenter(lnglat);
}
var marker = new AMap.Marker({
//title: data.name,
position: markerPos,
offset: new AMap.Pixel(-iconAttr.pointimgw/2, -iconAttr.pointimgh),
icon: icon
});
marker.on('mouseover', function(ev){
if (self.tipsConf.showtips) {
var tmpDom = $(self._dom).parent().find('div.ShdcAMap_custom_tips');
if (self.tipsConf.tiptype == "2") {
var tipFunc = function(){
return eval(self.tipsConf.tipJsPane);
}
tipFunc.call(data);
var tipContent = data.tipContent;
tmpDom.html(tipContent);
tmpDom.css({
"left": (ev.pixel.x + 10) + "px",
"top": (ev.pixel.y + 10) + "px"
});
tmpDom.show();
} else {
var tipHtmls = '<div>';
if (self.tipsConf.tipcode) {
tipHtmls += '编码:' + data.code + '<br/>';
}
if (self.tipsConf.tippoint) {
tipHtmls += '名字:' + data.name + '<br/>';
}
if (self.tipsConf.tipother) {
if (data.customName && data.customName.length == data.customValue.length) {
for (var i = 0; i < data.customName.length; i++) {
tipHtmls += data.customName[i] + ':' + data.customValue[i] + '<br/>';
}
}
}
tipHtmls += '</div>';
tmpDom.html(tipHtmls);
tmpDom.css({
"left": (ev.pixel.x + 10) + "px",
"top": (ev.pixel.y + 10) + "px"
});
tmpDom.show();
}
}
});
marker.on('mouseout', function(ev){
if (self.tipsConf.showtips) {
var tmpDom = $(self._dom).parent().find('div.ShdcAMap_custom_tips');
tmpDom.hide();
}
});
marker.on('click', function(ev){
self._customDoLink(data);
});
self.baseMap.add(marker);
}
if (data.type == "区域" || data.type == "组合") {
var polygon = new AMap.Polygon({
path: lnglat,
fillColor: iconAttr.fillColor,
fillOpacity: iconAttr.fillOpacity / 100,
strokeWeight: iconAttr.lineWidth,
strokeColor: iconAttr.lineColor,
strokeOpacity: 1
});
polygon.on('mouseover', function(ev){
if (self.tipsConf.showtips) {
var tmpDom = $(self._dom).parent().find('div.ShdcAMap_custom_tips');
if (self.tipsConf.tiptype == "2") {
var tipFunc = function(){
return eval(self.tipsConf.tipJsPane);
}
tipFunc.call(data);
var tipContent = data.tipContent;
tmpDom.html(tipContent);
tmpDom.css({
"left": (ev.pixel.x + 10) + "px",
"top": (ev.pixel.y + 10) + "px"
});
tmpDom.show();
} else {
var tipHtmls = '<div>';
if (self.tipsConf.tipcode) {
tipHtmls += '编码:' + data.code + '<br/>';
}
if (self.tipsConf.tippoint) {
tipHtmls += '名字:' + data.name + '<br/>';
}
if (self.tipsConf.tipother) {
if (data.customName && data.customName.length == data.customValue.length) {
for (var i = 0; i < data.customName.length; i++) {
tipHtmls += data.customName[i] + ':' + data.customValue[i] + '<br/>';
}
}
}
tipHtmls += '</div>';
tmpDom.html(tipHtmls);
tmpDom.css({
"left": (ev.pixel.x + 10) + "px",
"top": (ev.pixel.y + 10) + "px"
});
tmpDom.show();
}
}
});
polygon.on('mouseout', function(ev){
if (self.tipsConf.showtips) {
var tmpDom = $(self._dom).parent().find('div.ShdcAMap_custom_tips');
tmpDom.hide();
}
});
polygon.on('click', function(ev){
self._customDoLink(data);
});
self.baseMap.add(polygon);
}
},
lnglatToArr: function(fromStr){
var retArr = [];
if (fromStr) {
var lnglatArr = fromStr.split(",");
for (var i = 0; i < lnglatArr.length; i++) {
retArr.push(lnglatArr[i].trim().split(" "));
}
}
return retArr;
},
getAreaCenter: function(coords){
var total = coords.length;
var X = 0, Y = 0, Z = 0;
for (var i = 0; i < coords.length; i++) {
var lnglat = coords[i];
var lng = (lnglat.lng * Math.PI) / 180;
var lat = (lnglat.lat * Math.PI) / 180;
var x, y, z;
x = Math.cos(lat) * Math.cos(lng);
y = Math.cos(lat) * Math.sin(lng);
z = Math.sin(lat);
X += x;
Y += y;
Z += z;
}
X = X / total;
Y = Y / total;
Z = Z / total;
var Lng = Math.atan2(Y, X);
var Hyp = Math.sqrt(X * X + Y * Y);
var Lat = Math.atan2(Z, Hyp);
return [
parseFloat((Lng * 180) / Math.PI),
parseFloat((Lat * 180) / Math.PI)
];
},
calTextWidth: function(str, fontSize) {
var fontSize = fontSize || 12;
var strHtml = $('<span>')
.attr("id", "temp_cal_text_font_size")
.css({
"display": "none",
"font-size": fontSize + "px",
"font-family": "Microsoft YaHei"
}).html(str);
$(document.body).append(strHtml);
var width = $('#temp_cal_text_font_size').width();
var height = $('#temp_cal_text_font_size').height();
$('#temp_cal_text_font_size').remove();
return [width, height];
},
hexToRgba: function(hex, al) {
var hexColor = /^#/.test(hex) ? hex.slice(1) : hex,
alp = hex === 'transparent' ? 0 : Math.ceil(al),
r, g, b;
hexColor = /^[0-9a-f]{3}|[0-9a-f]{6}$/i.test(hexColor) ? hexColor : 'fffff';
if (hexColor.length === 3) {
hexColor = hexColor.replace(/(\w)(\w)(\w)/gi, '$1$1$2$2$3$3');
}
r = hexColor.slice(0, 2);
g = hexColor.slice(2, 4);
b = hexColor.slice(4, 6);
r = parseInt(r, 16);
g = parseInt(g, 16);
b = parseInt(b, 16);
return {
hex: '#' + hexColor,
alpha: alp,
rgba: 'rgba(' + r + ', ' + g + ', ' + b + ', ' + (alp / 100).toFixed(2) + ')'
};
},
isNullStr: function (val, def) {
if (typeof(val) == undefined || "" == val || null == val || val.length <= 0) {
if (typeof(def) == undefined || "" == def || null == def || def.length <= 0) {
return "";
}
return def;
}
if (val.trim) {
return val.trim();
}
return val;
},
isNullInt: function (val, def) {
if (typeof(val) == undefined || "" == val || null == val || val.length <= 0) {
if (typeof(def) == undefined || "" == def || null == def || def.length <= 0) {
return 0;
}
return parseInt(def);
}
return parseInt(val);
},
isNullBoolean: function (val, def) {
if (typeof(val) == undefined || "" == val || null == val) {
if (typeof(def) == undefined || "" == def || null == def) {
return false;
}
return def;
}
return val;
},
getAlign: function (align) {
if ("2" == align) {
return "left";
} else if ("0" == align) {
return "center";
} else if ("4" == align) {
return "right";
}
},
getFontStyle: function (style) {
if ("2" == style || "3" == style) {
return "italic";
} else {
return "normal";
}
},
getFontWeight: function(style){
if ("1" == style || "3" == style) {
return "bold";
} else {
return "normal";
}
}
});

110
样例模板.cpt

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<WorkBook xmlVersion="20170720" releaseVersion="10.0.0">
<TableDataMap>
<TableData name="ds1" class="com.fr.data.impl.EmbeddedTableData">
<Parameters/>
<DSName>
<![CDATA[]]></DSName>
<ColumnNames>
<![CDATA[编码,,.,,名字,,.,,场景,,.,,类型,,.,,经纬度,,.,,系列名,,.,,系列值,,.,,地块名称,,.,,土地面积,,.,,土地权利人]]></ColumnNames>
<ColumnTypes>
<![CDATA[java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String]]></ColumnTypes>
<RowData ColumnTypes="java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String">
<![CDATA[Fco$c"#13QfARE,5ZPdHCrb-p/<HN&(Ech1b(=IZ)]A#g4+`4anR>_BMUX!VMVp,%qE?LLrZ>
?*T*3[,pn,E.TnK%[=+c)Ln7^,.;657T5mBD!E(<Xg5H*':B0-hOOmS;NWTAAoBh1T8O/#q^
V"A3>_QuL29DPFCm"HYZA+u$Dj6rTi@UADR\Q1b!t77OhS0h[t]A)J"u%5sjj>!_1-m29)$^U
t)_JUWUO=oNXEk9N),F$YhZhDp%A=C]ARF>WF#WkoE8#iC'dG!dG$'I6>;[8'V*0Hg`"ElK$5
l^LQ4FG0mgrgTjuV"iD*FEOutZn'58%HF]A7R)W'7!mCg#;XB8cG3gY"UigH[K5H[I*/9q7pp
o[G)bT,i%k#0IS]Ar;c~
]]></RowData>
</TableData>
</TableDataMap>
<Report class="com.fr.report.worksheet.WorkSheet" name="sheet1">
<ReportPageAttr>
<HR/>
<FR/>
<HC/>
<FC/>
</ReportPageAttr>
<ColumnPrivilegeControl/>
<RowPrivilegeControl/>
<RowHeight defaultValue="723900">
<![CDATA[723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900]]></RowHeight>
<ColumnWidth defaultValue="2743200">
<![CDATA[2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200]]></ColumnWidth>
<FloatElementList>
<com.fr.report.cell.FloatElement>
<FloatElementName name="Float4"/>
<PrivilegeControl/>
<Location leftDistance="304800" topDistance="152400" width="23279100" height="17411700"/>
<O t="CC">
<LayoutAttr selectedIndex="0"/>
<ChangeAttr enable="false" changeType="button" timeInterval="5" buttonColor="-8421505" carouselColor="-8421505" showArrow="true">
<TextAttr>
<Attr alignText="0"/>
</TextAttr>
</ChangeAttr>
<Chart name="默认" chartClass="com.fr.plugin.shdcmap.CustomChart">
<attr refreshEnabled="false" refreshTime="10.0" mapConf="{&quot;mapzoom&quot;:10.0,&quot;centerx&quot;:&quot;121.474488&quot;,&quot;centery&quot;:&quot;31.233588&quot;,&quot;mapStyle&quot;:&quot;d82836f41b8b6f6123697c763867a5b1&quot;,&quot;showGovRegion&quot;:false}" tipsConf="{&quot;showtips&quot;:true,&quot;tipbgcolor&quot;:&quot;#000000&quot;,&quot;tiptransparent&quot;:60.0,&quot;tipsize&quot;:11,&quot;tipstyle&quot;:1,&quot;tipfamily&quot;:&quot;微软雅黑&quot;,&quot;tipcolor&quot;:&quot;#ffffff&quot;,&quot;tipbgwidth&quot;:150.0,&quot;tipcode&quot;:true,&quot;tippoint&quot;:true,&quot;tipother&quot;:true,&quot;tiptype&quot;:1,&quot;tipJsPane&quot;:&quot;console.log(this);&quot;}" iconConf="[{&quot;pointSize&quot;:16.0,&quot;pointimg&quot;:&quot;iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACNklEQVR4nL2XPUgcQRTHt3DeXKJoEcTE7MzcGQsRTCNYWKURAknA1s6PJoVYCPZWqYKVIKZIJRamEIVY2ASSQkkVE3O75/lVKKSwFgQheW+5O4+Ttzdzu5uBPwwz8+b/m6/Hruc5lHPz8EmgYTFQsBdqOEPdoK5QP1HbR1q+dpnPqZAxmlyi/jbRdujLl6kZl/IwgJOGFsYNkiuJzU/6vC534zuVtFxNBBAa+JgEIJIR0y2ai5nE5hWVNQy6A2j5NS0AusBO5iUF4xYTX+MRHUSieuxdgEMngECJ97HmCnaOfdlfHU91aouL+d3tdVgDYMBazGQbMXEbXNwvJZ/Z74AWu9xEmO3muDjqY++BaRu1BqD3y07kt71gwbGPizvufaDsd8DIWf78xVsujvqYuEtrcypFLcfYG21gn4ujPibusxNAtBoN3/nzFEvlx153dSzVqY0dr8SkO4CRC03e9jW974ri8sDZQY/X7gwQPPUeYXBgkZDihQtxNq/tghJTyQDkt5bNaxAGNlsFCLR8kxgAk9IwnvGtqznmkg+Jze8g4J3bysWfcr8nUwOoQBxaAyg5n6o5laKRr6wAlPiSunm1oMGnZgDFQs5kBlCBuInLkJmaRwD4kckAXGRuXoNQ8OPes/PFyH8xx+fVeaRzfQ0AW6eF9h7qy9Q8yOfylJii5KTEct27H64qNLlCdgB1RpEUrKMmGtuzA6jbAU6Z7gAVOuci/qaX8Ss39OF54MMQmbZ6B/4B04EuO98sPxEAAAAASUVORK5CYII=&quot;,&quot;pointimgtype&quot;:&quot;png&quot;,&quot;pointimgw&quot;:32,&quot;pointimgh&quot;:32,&quot;lineWidth&quot;:3.0,&quot;lineColor&quot;:&quot;#ffffff&quot;,&quot;fillColor&quot;:&quot;#00ff00&quot;,&quot;fillOpacity&quot;:60.0,&quot;titleName&quot;:&quot;默认&quot;}]"/>
<DataSet class="com.fr.extended.chart.ExtendedTableDataSet">
<TableData class="com.fr.data.impl.NameTableData">
<Name>
<![CDATA[ds1]]></Name>
</TableData>
<AbstractDataConfig class="com.fr.plugin.shdcmap.data.CustomDataConfig" pluginID="com.fr.plugin.shdcmap.v10">
<attr code="编码" code_customName="" name="名字" name_customName="" type="场景" type_customName="" icon="类型" icon_customName="" coords="经纬度" coords_customName="" customName="true" customField_0="地块名称" customField_0_function="com.fr.data.util.function.NoneFunction" customField_0_customName="地块名称" customField_1="土地面积" customField_1_function="com.fr.data.util.function.NoneFunction" customField_1_customName="土地面积" customField_2="土地权利人" customField_2_function="com.fr.data.util.function.NoneFunction" customField_2_customName="土地权利人"/>
</AbstractDataConfig>
</DataSet>
</Chart>
</O>
<Style index="0"/>
</com.fr.report.cell.FloatElement>
</FloatElementList>
<CellElementList>
<C c="0" r="0">
<PrivilegeControl/>
<Expand/>
</C>
<C c="11" r="0">
<PrivilegeControl/>
<Expand dir="0"/>
</C>
</CellElementList>
<ReportAttrSet>
<ReportSettings headerHeight="0" footerHeight="0">
<PaperSetting/>
<Background name="ColorBackground" color="-1"/>
</ReportSettings>
<Header reportPageType="0">
<Background name="NullBackground"/>
<LeftList/>
<CenterList/>
<RightList/>
</Header>
<Footer reportPageType="0">
<Background name="NullBackground"/>
<LeftList/>
<CenterList/>
<RightList/>
</Footer>
</ReportAttrSet>
<PrivilegeControl/>
</Report>
<ReportParameterAttr>
<Attributes showWindow="true" delayPlaying="true" windowPosition="1" align="0" useParamsTemplate="true"/>
<PWTitle>
<![CDATA[参数]]></PWTitle>
</ReportParameterAttr>
<StyleList>
<Style imageLayout="1">
<FRFont name="SimSun" style="0" size="72"/>
<Background name="ColorBackground" color="-1"/>
<Border/>
</Style>
</StyleList>
<DesignerVersion DesignerVersion="KAA"/>
<PreviewType PreviewType="0"/>
<TemplateIdAttMark class="com.fr.base.iofile.attr.TemplateIdAttrMark">
<TemplateIdAttMark TemplateId="4780bd0d-47a7-447a-92dc-d247f71b2143"/>
</TemplateIdAttMark>
</WorkBook>
Loading…
Cancel
Save