From abbf6c96a71f9ba9ab853a3adceac41b79cb7695 Mon Sep 17 00:00:00 2001
From: sbjw <sbjw.happy@163.com>
Date: Thu, 28 Aug 2025 06:21:54 +0000
Subject: [PATCH] 修复showLayer和hideLayer功能
---
src/example/ExampleLayerPage.js | 14 ++++++++++++++
src/example/ExamplePage.js | 17 +++++++++++++++++
package.json | 2 +-
public/example/ExampleLayerPage.md | 14 ++++++++++++++
src/example/ExampleDynamicBlcPage.js | 5 +++++
public/example/ExampleDynamicBlcPage.md | 5 +++++
6 files changed, 56 insertions(+), 1 deletions(-)
diff --git a/package.json b/package.json
index dfa579d..ccf6ebc 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,7 @@
"@ant-design/icons": "^4.0.0",
"antd": "^4.24.16",
"echarts": "^5.6.0",
- "iclient3d-plot-diy": "^1.0.15",
+ "iclient3d-plot-diy": "^1.0.16",
"iclient3d-plot-diy-attachment": "^1.0.1",
"jquery": "^3.7.1",
"react-draggable": "^3.3.2",
diff --git a/public/example/ExampleDynamicBlcPage.md b/public/example/ExampleDynamicBlcPage.md
index d9d228c..c67e769 100644
--- a/public/example/ExampleDynamicBlcPage.md
+++ b/public/example/ExampleDynamicBlcPage.md
@@ -5,6 +5,7 @@
import React, {Component} from 'react'
import './ExampleDrawPage.css'
import {GIS} from "iclient3d-plot-diy";
+import {Button} from "antd";
export default class ExampleDynamicDlcPage extends Component {
@@ -56,6 +57,10 @@
iconScales={[[0, 100000], [100000, 500000], [500000, 1000000], [1000000, 2000000], [2000000, 20000000]]}
/>
</div>
+ <Button type="primary" onClick={() => this.mapFunction.mapApiService.enableTilt()}>启用旋转和倾斜
+ </Button>
+ <Button type="primary" onClick={() => this.mapFunction.mapApiService.disableTilt()}>禁用旋转和倾斜
+ </Button>
<div className={"code_wrapper"}>
<div dangerouslySetInnerHTML={{__html: this.state.htmlString}}></div>
</div>
diff --git a/public/example/ExampleLayerPage.md b/public/example/ExampleLayerPage.md
index 987b359..f4702d3 100644
--- a/public/example/ExampleLayerPage.md
+++ b/public/example/ExampleLayerPage.md
@@ -36,6 +36,9 @@
addDemLayer() {
this.mapFunction.updateDemLayer(this.state.terrainUrl, true);
}
+ removeDemLayer() {
+ this.mapFunction.removeDemLayer(this.state.terrainUrl, true);
+ }
addGeoJsonLayer() {
this.mapFunction.showGeoJsonDataSource({
@@ -49,12 +52,20 @@
}, true);
}
+ hideGeoJsonLayer() {
+ this.mapFunction.hideLayer('id_for_geojson');
+ }
+
addSuperMapImageryLayer() {
this.mapFunction.showSuperMapImageryProvider({
code: 'id_for_imagery_provider',
url: this.state.superMapImageryUrl,
name: 'supermap_imagery_provider'
}, true);
+ }
+
+ hideSuperMapImageryLayer() {
+ this.mapFunction.hideLayer('id_for_imagery_provider');
}
render() {
@@ -79,18 +90,21 @@
value={this.state['terrainUrl']}
onChange={(v) => this.setState({terrainUrl: v.target.value})}/>
<Button type="primary" onClick={this.addDemLayer.bind(this)}>添加地形</Button>
+ <Button type="primary" onClick={this.removeDemLayer.bind(this)}>移除地形</Button>
<br/>
<span>矢量服务地址:</span>
<input type="text" placeholder={'请输入矢量服务地址'}
value={this.state['geojsonUrl']}
onChange={(v) => this.setState({geojsonUrl: v.target.value})}/>
<Button type="primary" onClick={this.addGeoJsonLayer.bind(this)}>添加矢量</Button>
+ <Button type="primary" onClick={this.hideGeoJsonLayer.bind(this)}>关闭矢量</Button>
<br/>
<span>影像服务地址:</span>
<input type="text" placeholder={'请输入影像服务地址'}
value={this.state['superMapImageryUrl']}
onChange={(v) => this.setState({superMapImageryUrl: v.target.value})}/>
<Button type="primary" onClick={this.addSuperMapImageryLayer.bind(this)}>添加影像</Button>
+ <Button type="primary" onClick={this.hideSuperMapImageryLayer.bind(this)}>关闭影像</Button>
</div>
<div className={"code_wrapper"}>
<div dangerouslySetInnerHTML={{__html: this.state.htmlString}}></div>
diff --git a/src/example/ExampleDynamicBlcPage.js b/src/example/ExampleDynamicBlcPage.js
index 6d6b495..5097d00 100644
--- a/src/example/ExampleDynamicBlcPage.js
+++ b/src/example/ExampleDynamicBlcPage.js
@@ -1,6 +1,7 @@
import React, {Component} from 'react'
import './ExampleDrawPage.css'
import {GIS} from "iclient3d-plot-diy";
+import {Button} from "antd";
export default class ExampleDynamicDlcPage extends Component {
@@ -52,6 +53,10 @@
iconScales={[[0, 100000], [100000, 500000], [500000, 1000000], [1000000, 2000000], [2000000, 20000000]]}
/>
</div>
+ <Button type="primary" onClick={() => this.mapFunction.mapApiService.enableTilt()}>启用旋转和倾斜
+ </Button>
+ <Button type="primary" onClick={() => this.mapFunction.mapApiService.disableTilt()}>禁用旋转和倾斜
+ </Button>
<div className={"code_wrapper"}>
<div dangerouslySetInnerHTML={{__html: this.state.htmlString}}></div>
</div>
diff --git a/src/example/ExampleLayerPage.js b/src/example/ExampleLayerPage.js
index aec00e6..ab29d34 100644
--- a/src/example/ExampleLayerPage.js
+++ b/src/example/ExampleLayerPage.js
@@ -32,6 +32,9 @@
addDemLayer() {
this.mapFunction.updateDemLayer(this.state.terrainUrl, true);
}
+ removeDemLayer() {
+ this.mapFunction.removeDemLayer(this.state.terrainUrl, true);
+ }
addGeoJsonLayer() {
this.mapFunction.showGeoJsonDataSource({
@@ -45,12 +48,20 @@
}, true);
}
+ hideGeoJsonLayer() {
+ this.mapFunction.hideLayer('id_for_geojson');
+ }
+
addSuperMapImageryLayer() {
this.mapFunction.showSuperMapImageryProvider({
code: 'id_for_imagery_provider',
url: this.state.superMapImageryUrl,
name: 'supermap_imagery_provider'
}, true);
+ }
+
+ hideSuperMapImageryLayer() {
+ this.mapFunction.hideLayer('id_for_imagery_provider');
}
render() {
@@ -75,18 +86,21 @@
value={this.state['terrainUrl']}
onChange={(v) => this.setState({terrainUrl: v.target.value})}/>
<Button type="primary" onClick={this.addDemLayer.bind(this)}>添加地形</Button>
+ <Button type="primary" onClick={this.removeDemLayer.bind(this)}>移除地形</Button>
<br/>
<span>矢量服务地址:</span>
<input type="text" placeholder={'请输入矢量服务地址'}
value={this.state['geojsonUrl']}
onChange={(v) => this.setState({geojsonUrl: v.target.value})}/>
<Button type="primary" onClick={this.addGeoJsonLayer.bind(this)}>添加矢量</Button>
+ <Button type="primary" onClick={this.hideGeoJsonLayer.bind(this)}>关闭矢量</Button>
<br/>
<span>影像服务地址:</span>
<input type="text" placeholder={'请输入影像服务地址'}
value={this.state['superMapImageryUrl']}
onChange={(v) => this.setState({superMapImageryUrl: v.target.value})}/>
<Button type="primary" onClick={this.addSuperMapImageryLayer.bind(this)}>添加影像</Button>
+ <Button type="primary" onClick={this.hideSuperMapImageryLayer.bind(this)}>关闭影像</Button>
</div>
<div className={"code_wrapper"}>
<div dangerouslySetInnerHTML={{__html: this.state.htmlString}}></div>
diff --git a/src/example/ExamplePage.js b/src/example/ExamplePage.js
index c59ac29..907f622 100644
--- a/src/example/ExamplePage.js
+++ b/src/example/ExamplePage.js
@@ -15,6 +15,7 @@
plotLanguage: localStorage.getItem('plot_language') || '',
imageUrl: localStorage.getItem('plot_image') || '',
demUrl: localStorage.getItem('plot_dem') || '',
+ addressSearchUrl: localStorage.getItem('addressSearchUrl') || '',
};
}
@@ -33,6 +34,11 @@
updateDemUrl(event) {
localStorage.setItem('plot_dem', this.state.demUrl || '');
+ alert('plotUrl服务地址设置成功');
+ }
+
+ updateAddressSearchUrl(event) {
+ localStorage.setItem('addressSearchUrl', this.state.addressSearchUrl || '');
alert('plotUrl服务地址设置成功');
}
@@ -101,6 +107,17 @@
<Button type="primary" onClick={this.updateDemUrl.bind(this)}>设置</Button>
</Input.Group>
<br/>
+
+ <span>公共地址查询URL:</span>
+ <Input.Group compact>
+ <Input
+ placeholder={'公共地址查询URL'}
+ defaultValue={this.state['addressSearchUrl']}
+ onChange={(v) => this.setState({addressSearchUrl: v.target.value})}
+ />
+ <Button type="primary" onClick={this.updateAddressSearchUrl.bind(this)}>设置</Button>
+ </Input.Group>
+ <br/>
<span>公共语言:</span>
<Button type="primary" onClick={this.updateLanguage1.bind(this)}>中文</Button>
<Button type="primary" onClick={this.updateLanguage2.bind(this)}>英文</Button>
--
Gitblit v1.9.3