Skip to content

Commit 4d2f046

Browse files
committed
Merge branch 'master' of https://github.com/MyShallowTime/iClient-JavaScript into master
# Conflicts: # examples/mapboxgl-v2/src/application/App.tsx
2 parents 3e65825 + 2e1b8cf commit 4d2f046

File tree

11 files changed

+308
-106
lines changed

11 files changed

+308
-106
lines changed

examples/mapboxgl-v2/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Package Files #
22
/node_modules
33
/package-lock.json
4+
/dist
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!doctype html>
2+
<html lang="zh">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="initial-scale=1,user-scalable=no,width=device-width">
7+
<title>中国地图</title>
8+
</head>
9+
10+
<body>
11+
<div id="root"></div>
12+
<script src="symbol/static/fonts/iconfont.js"></script>
13+
<script src="symbol/libs/mapboxgl/mapbox-gl-dev-v1.13.2.js"></script>
14+
<link href="https://iclient.supermap.io/web/libs/mapbox-gl-js/1.13.2/mapbox-gl.css" rel="stylesheet" />
15+
<script src="../../dist/mapboxgl/iclient-mapboxgl.js"></script>
16+
</body>
17+
18+
</html>

examples/mapboxgl-v2/build/webpack.config.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ module.exports = WebpackMerge(baseConfig, {
2929
plugins: [
3030
new webpack.DefinePlugin({
3131
'process.env': {
32-
MAPLIBRE: true
32+
DEV: true
3333
}
3434
}),
3535
new HtmlWebpackPlugin({
3636
filename: 'index.html',
37-
excludeChunks: ['landuse'],
38-
template: path.resolve(__dirname, '../src/index.html')
37+
template: path.resolve(__dirname, '../index.html')
3938
}),
4039
new OpenBrowserPlugin({
4140
url: `http://127.0.0.1:${PORT}/index.html`
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/**
2+
* 当前打包配置的打包结果用于iclient站点示例使用,
3+
* 通过可访问 http://localhost:8082/examples/mapboxgl/editor.html#symbol
4+
*
5+
*/
6+
7+
const path = require('path');
8+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
9+
const HtmlWebpackPlugin = require('html-webpack-plugin');
10+
const CopyPlugin = require('copy-webpack-plugin');
11+
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
12+
13+
module.exports = {
14+
entry: {
15+
symbol: path.resolve('src/index.tsx')
16+
},
17+
output: {
18+
path: path.resolve('dist'),
19+
filename: 'symbol/js/[name].js'
20+
},
21+
mode: 'production',
22+
module: {
23+
rules: [{
24+
test: /\.(tsx|ts)$/,
25+
use: 'babel-loader',
26+
exclude: path.resolve('node_modules')
27+
},
28+
{
29+
test: /\.less$/,
30+
use: [{
31+
loader: MiniCssExtractPlugin.loader,
32+
options: {
33+
publicPath: './'
34+
}
35+
},
36+
'css-loader',
37+
{
38+
loader: 'less-loader',
39+
options: {
40+
lessOptions: {
41+
javascriptEnabled: true,
42+
math: "always"
43+
}
44+
}
45+
}]
46+
}]
47+
},
48+
resolve: {
49+
extensions: ['.ts', '.tsx', '.js', '.jsx']
50+
},
51+
externals: {
52+
'mapbox-gl': 'mapboxgl'
53+
},
54+
optimization: {
55+
splitChunks: {
56+
cacheGroups: {
57+
vendors: {
58+
// node_modules内的依赖库
59+
chunks: 'all',
60+
test: /[\\/]node_modules[\\/]/,
61+
name: 'vendors',
62+
priority: 5,
63+
reuseExistingChunk: true
64+
}
65+
}
66+
}
67+
},
68+
plugins: [
69+
new MiniCssExtractPlugin({
70+
filename: "symbol/css/symbol.css",
71+
ignoreOrder: true
72+
}),
73+
new HtmlWebpackPlugin({
74+
filename: 'symbol.html',
75+
template: path.resolve('build/template.html')
76+
}),
77+
// new BundleAnalyzerPlugin({ analyzerPort: 8086 }),// 分析包大小使用的插件
78+
new CopyPlugin([
79+
{ from: './static/fonts', to: './symbol/static/fonts' },
80+
{ from: './libs/mapboxgl/mapbox-gl-dev-v1.13.2.js', to: './symbol/libs/mapboxgl' }// TODO,之后使用mapbox-gl-enhance
81+
])
82+
]
83+
}

examples/mapboxgl-v2/src/index.html renamed to examples/mapboxgl-v2/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
<div id="root"></div>
1313
<script src="../static/fonts/iconfont.js"></script>
1414
<script type="text/javascript" src="../libs/mapboxgl/mapbox-gl-dev-v1.13.2.js"></script>
15-
<!-- <script type="text/javascript" src="https://iclient.supermap.io/web/libs/mapbox-gl-js/1.13.2/mapbox-gl.js"></script> -->
1615
<link href='https://iclient.supermap.io/web/libs/mapbox-gl-js/1.13.2/mapbox-gl.css' rel='stylesheet' />
17-
<script type="text/javascript" src="../libs/mapboxgl/iclient-mapboxgl.js"></script>
16+
<script type="text/javascript" src="../libs/mapboxgl/iclient-mapboxgl.js"></script>
1817

1918
<!-- maplibre + l7 + 符号库 -->
2019
<!-- <script type="text/javascript" src="https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js"></script>

examples/mapboxgl-v2/package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "",
55
"scripts": {
66
"dev": "webpack-dev-server --config ./build/webpack.config.js",
7-
"dev-docs": "webpack-dev-server --config ./build/webpack.dev.docs.config"
8-
7+
"dev-docs": "webpack-dev-server --config ./build/webpack.dev.docs.config",
8+
"dist": "webpack --config ./build/webpack.pro.config.js"
99
},
1010
"devDependencies": {
1111
"@babel/cli": "^7.20.7",
@@ -20,6 +20,7 @@
2020
"babel-cli": "^6.26.0",
2121
"babel-loader": "8.0.2",
2222
"babel-preset-react-app": "^10.0.1",
23+
"copy-webpack-plugin": "^5.1.1",
2324
"cross-env": "^7.0.2",
2425
"css-loader": "^5.0.0",
2526
"file-loader": "^6.2.0",
@@ -32,20 +33,17 @@
3233
"typescript": "^4.9.4",
3334
"url-loader": "^4.0.0",
3435
"webpack": "^4.44.1",
36+
"webpack-bundle-analyzer": "^4.9.0",
3537
"webpack-cli": "^3.3.12",
3638
"webpack-dev-server": "^3.11.0",
3739
"webpack-merge": "^4.2.2"
3840
},
3941
"dependencies": {
40-
"@antv/g2": "^4.2.9",
41-
"@antv/l7": "^2.13.1",
4242
"@ispeco/iptl-components-react": "^3.0.7",
4343
"classnames": "^2.2.6",
4444
"lodash": "^4.17.21",
4545
"maplibre-gl": "^2.4.0",
4646
"react": "^16.14.0",
47-
"react-dom": "^16.14.0",
48-
"react-router-dom": "^6.8.2",
49-
"react-syntax-highlighter": "^15.5.0"
47+
"react-dom": "^16.14.0"
5048
}
5149
}

examples/mapboxgl-v2/src/application/App.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import View from './View';
33
import './style';
44
import { isArray, uniqueId } from 'lodash';
55
import { getMapboxKey, isPaintKey } from '../utils/StyleSettingUtil';
6-
import '../../../../src/mapboxgl/core/MapExtend';
6+
// import '../../../../src/mapboxgl/core/MapExtend';
7+
import {getSymbolBaseUrl} from '../utils/symbol-resource-util';
78

89
const SET_PROPERTY_RULE = {
910
paint: 'setPaintProperty',
@@ -13,14 +14,17 @@ const App = () => {
1314
const [map, setMap] = useState<any>();
1415
const [layersInfo, setLayersInfo] = useState<any[]>([]);
1516
const url = 'http://172.16.14.182:8090/iserver/services/map-China100/rest/maps/China';
17+
// const url = 'https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China';
18+
// const url ='http://support.supermap.com.cn:8090/iserver/services/map-china400/rest/maps/China'
1619

1720
// 初始化
1821
useEffect(() => {
1922
!!map && addStyle();
2023
}, [!!map]);
2124

2225
const onLoadedMap = async (map: any) => {
23-
(window as any).mapboxgl.supermap.WebSymbol.basePath = "../../libs/resources/symbols";
26+
const url = getSymbolBaseUrl();
27+
(window as any).mapboxgl.supermap.WebSymbol.basePath = url;
2428
setMap(map);
2529
}
2630

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from 'react';
2+
import SelectEditor from '../../components/select-editor';
3+
import { ScrollPanel } from '@ispeco/iptl-components-react';
4+
import EditorLayout from '../../components/editor-layout';
5+
6+
const SymbolContent = (props: any) => {
7+
const { options, activeCategory, setActiveCategory, activeStyle, activeStyleOptions, setActiveStyle, children } = props;
8+
return (
9+
<div className='symbol-content'>
10+
{options && <EditorLayout title='类别'>
11+
<SelectEditor options={options} value={activeCategory} onChange={setActiveCategory} />
12+
</EditorLayout>}
13+
{activeStyle && <EditorLayout title='风格'>
14+
<SelectEditor options={activeStyleOptions} value={activeStyle} onChange={setActiveStyle} />
15+
</EditorLayout>}
16+
<ScrollPanel hideScrollX small style={{ height: activeStyle ? 477 : 517, marginTop: 16 }}>
17+
{children}
18+
</ScrollPanel>
19+
</div>
20+
)
21+
}
22+
23+
export default SymbolContent;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy