gis-map-xinjiang 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -3
- package/packages/gisMapXinJiang/component/ClusterList.vue +140 -0
- package/packages/gisMapXinJiang/index.vue +183 -0
- package/packages/gisMapXinJiang/js/icon.js +87 -0
- package/packages/gisMapXinJiang/js/initBaseLayers.js +550 -0
- package/packages/gisMapXinJiang/js/olms.js +28 -0
- package/packages/gisMapXinJiang/js/utills.js +315 -0
- package/packages/index.js +26 -0
- /package/dist/{gis-map-xinjiang.mjs → gismap.es.js} +0 -0
- /package/dist/{gis-map-xinjiang.umd.js → gismap.umd.js} +0 -0
package/package.json
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gis-map-xinjiang",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "GIS通用组件 - Vue 3 版本",
|
|
5
5
|
"main": "dist/gismap.umd.js",
|
|
6
6
|
"module": "dist/gismap.es.js",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist
|
|
8
|
+
"dist",
|
|
9
|
+
"packages/**/*"
|
|
9
10
|
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/gismap.es.js",
|
|
14
|
+
"require": "./dist/gismap.umd.js"
|
|
15
|
+
},
|
|
16
|
+
"./packages/*": "./packages/*"
|
|
17
|
+
},
|
|
10
18
|
"scripts": {
|
|
11
19
|
"dev": "vite",
|
|
12
20
|
"build": "vite build",
|
|
13
|
-
"preview": "vite preview"
|
|
21
|
+
"preview": "vite preview",
|
|
22
|
+
"lib": "vite build"
|
|
14
23
|
},
|
|
15
24
|
"dependencies": {
|
|
16
25
|
"@supermap/iclient-ol": "^11.1.1",
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="clusterListPopup">
|
|
3
|
+
<ul class="paginate-list">
|
|
4
|
+
<li
|
|
5
|
+
class="list-item"
|
|
6
|
+
v-for="(item, index) in clusterList"
|
|
7
|
+
:key="index"
|
|
8
|
+
:class="{ active: selectedIndex === index }"
|
|
9
|
+
@click="danji(item, index)"
|
|
10
|
+
>
|
|
11
|
+
<!-- <img class="item-icon" :src="item.iconUrl" /> -->
|
|
12
|
+
<div class="item-content" :title="item.otherInfo.name">
|
|
13
|
+
{{ item.otherInfo.name }}
|
|
14
|
+
</div>
|
|
15
|
+
</li>
|
|
16
|
+
</ul>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
export default {
|
|
22
|
+
props: {
|
|
23
|
+
popupAttr: Array,
|
|
24
|
+
},
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
clusterList: [],
|
|
28
|
+
rightComponent: null,
|
|
29
|
+
popupAttributes: null,
|
|
30
|
+
selectedIndex: null // 当前选中的索引
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
mounted() {
|
|
34
|
+
this.selectedIndex = 0;
|
|
35
|
+
},
|
|
36
|
+
computed: {},
|
|
37
|
+
methods: {
|
|
38
|
+
danji(item, index) {
|
|
39
|
+
this.selectedIndex = index;
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
},
|
|
43
|
+
watch: {
|
|
44
|
+
popupAttr: {
|
|
45
|
+
handler(newVal, oldVal) {
|
|
46
|
+
this.clusterList = newVal.map((e) => e.getProperties());
|
|
47
|
+
},
|
|
48
|
+
immediate: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
53
|
+
<style scoped>
|
|
54
|
+
.clusterListPopup {
|
|
55
|
+
width: 2.75rem;
|
|
56
|
+
height: 1.9rem;
|
|
57
|
+
font-size: 0.1rem;
|
|
58
|
+
text-align: center;
|
|
59
|
+
display: flex;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
align-items: center;
|
|
62
|
+
}
|
|
63
|
+
ul li {
|
|
64
|
+
list-style-type: none;
|
|
65
|
+
}
|
|
66
|
+
.paginate-list li {
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
padding: 0.032rem;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.paginate-list li.active {
|
|
72
|
+
background: linear-gradient(90deg, #01AAFD 0%, rgba(23, 148, 255, 0) 100%);
|
|
73
|
+
color: white;
|
|
74
|
+
}
|
|
75
|
+
.list-item {
|
|
76
|
+
height: 0.156rem;
|
|
77
|
+
padding: 1.3% 0;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: left;
|
|
82
|
+
border-bottom: thin solid rgba(255, 255, 255, 0.3);
|
|
83
|
+
}
|
|
84
|
+
.list-item:hover {
|
|
85
|
+
/* color: #007bff; */
|
|
86
|
+
background: linear-gradient(90deg, #01AAFD 0%, rgba(23, 148, 255, 0) 100%);
|
|
87
|
+
}
|
|
88
|
+
.item-icon {
|
|
89
|
+
width: 0.16rem;
|
|
90
|
+
height: 0.16rem;
|
|
91
|
+
margin-right: 0.065rem;
|
|
92
|
+
}
|
|
93
|
+
.item-content {
|
|
94
|
+
letter-spacing: 1px;
|
|
95
|
+
white-space: nowrap;
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
text-overflow: ellipsis;
|
|
98
|
+
}
|
|
99
|
+
.paginate-list {
|
|
100
|
+
height: 100%;
|
|
101
|
+
width: 0.65rem;
|
|
102
|
+
padding: 0;
|
|
103
|
+
margin: 1% 0 0 0;
|
|
104
|
+
overflow: auto;
|
|
105
|
+
font-size: 0.073rem;
|
|
106
|
+
background: rgba(0,112,195,0.3);
|
|
107
|
+
}
|
|
108
|
+
*::-webkit-scrollbar {
|
|
109
|
+
width: 0.07rem;
|
|
110
|
+
height: 0.07rem;
|
|
111
|
+
}
|
|
112
|
+
*::-webkit-scrollbar-button {
|
|
113
|
+
width: 0;
|
|
114
|
+
height: 0;
|
|
115
|
+
display: none;
|
|
116
|
+
}
|
|
117
|
+
*::-webkit-scrollbar-corner {
|
|
118
|
+
background-color: transparent;
|
|
119
|
+
}
|
|
120
|
+
*::-webkit-scrollbar-thumb {
|
|
121
|
+
min-height: 0.078rem;
|
|
122
|
+
border: 0.026rem solid transparent;
|
|
123
|
+
background-clip: content-box;
|
|
124
|
+
border-radius: 7px;
|
|
125
|
+
background-color: #c8d5e1;
|
|
126
|
+
}
|
|
127
|
+
*::-webkit-scrollbar-thumb:hover {
|
|
128
|
+
background-color: #a8bbcf;
|
|
129
|
+
}
|
|
130
|
+
*::-webkit-scrollbar-thumb:active {
|
|
131
|
+
background-color: #87a2bd;
|
|
132
|
+
}
|
|
133
|
+
*::-webkit-scrollbar-track {
|
|
134
|
+
background-color: transparent;
|
|
135
|
+
}
|
|
136
|
+
*::-webkit-scrollbar-track-piece {
|
|
137
|
+
background-color: transparent;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
</style>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="themeClass">
|
|
3
|
+
<div
|
|
4
|
+
id="map"
|
|
5
|
+
:class="mapBackground"
|
|
6
|
+
:style="{ '--height': mapBoxHeight }"
|
|
7
|
+
></div>
|
|
8
|
+
<div class="popupBox" v-show="shopPopup" ref="popup">
|
|
9
|
+
<div id="popupHeader">
|
|
10
|
+
<div id="popupHeaderTitle">详细信息</div>
|
|
11
|
+
<div id="closePopup" @click="closePopup"></div>
|
|
12
|
+
</div>
|
|
13
|
+
<div id="popupContent">
|
|
14
|
+
<component
|
|
15
|
+
:is="currentTabComponent"
|
|
16
|
+
:popupAttr="popupAttributes"
|
|
17
|
+
ref="infoWindowRef"
|
|
18
|
+
@clickPointEvent="clickPointEvent"
|
|
19
|
+
></component>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup>
|
|
26
|
+
import { ref, computed, onMounted, watch, defineProps, defineEmits } from 'vue'
|
|
27
|
+
import "ol/ol.css";
|
|
28
|
+
import { Map, View } from "ol";
|
|
29
|
+
import { defaults } from "ol/control";
|
|
30
|
+
// import "ol-mapbox-style/dist/olms.js";
|
|
31
|
+
import { fromLonLat } from "ol/proj";
|
|
32
|
+
import { useBaseLayers } from "./js/initBaseLayers";
|
|
33
|
+
|
|
34
|
+
// 定义props
|
|
35
|
+
const props = defineProps({
|
|
36
|
+
mapBoxHeight: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "100vh",
|
|
39
|
+
},
|
|
40
|
+
mapZoom: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "8.3",
|
|
43
|
+
},
|
|
44
|
+
mapCenter: {
|
|
45
|
+
type: Array,
|
|
46
|
+
default: () => [118.65, 36.23],
|
|
47
|
+
},
|
|
48
|
+
themeStyle: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "dark",
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// 定义emits
|
|
55
|
+
const emit = defineEmits(['clickPointEvent']);
|
|
56
|
+
|
|
57
|
+
// 响应式数据
|
|
58
|
+
const map = ref(null);
|
|
59
|
+
const shopPopup = ref(false);
|
|
60
|
+
const currentTabComponent = ref(null);
|
|
61
|
+
const popupAttributes = ref(null);
|
|
62
|
+
const popup = ref(null);
|
|
63
|
+
const infoWindowRef = ref(null);
|
|
64
|
+
|
|
65
|
+
// 计算属性
|
|
66
|
+
const normalizedThemeStyle = computed(() => {
|
|
67
|
+
return ["dark", "light", "yingxiang"].includes(props.themeStyle)
|
|
68
|
+
? props.themeStyle
|
|
69
|
+
: "dark";
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const themeClass = computed(() => {
|
|
73
|
+
return {
|
|
74
|
+
"theme-dark": normalizedThemeStyle.value === "dark",
|
|
75
|
+
"theme-light": normalizedThemeStyle.value === "light",
|
|
76
|
+
"theme-yingxiang": normalizedThemeStyle.value === "yingxiang",
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const mapBackground = computed(() => {
|
|
81
|
+
return {
|
|
82
|
+
"map-dark-background": normalizedThemeStyle.value === "dark",
|
|
83
|
+
"map-light-background": normalizedThemeStyle.value === "light",
|
|
84
|
+
"map-yingxiang-background": normalizedThemeStyle.value === "yingxiang",
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// 使用 useBaseLayers composable
|
|
89
|
+
const {
|
|
90
|
+
initBaseLayers,
|
|
91
|
+
overlayPopup
|
|
92
|
+
} = useBaseLayers(map, normalizedThemeStyle, emit);
|
|
93
|
+
|
|
94
|
+
// 方法
|
|
95
|
+
const initMap = () => {
|
|
96
|
+
map.value = new Map({
|
|
97
|
+
target: "map",
|
|
98
|
+
view: new View({
|
|
99
|
+
center: props.mapCenter,
|
|
100
|
+
zoom: parseFloat(props.mapZoom),
|
|
101
|
+
projection: "EPSG:4326",
|
|
102
|
+
extent: [50, 23, 122, 58],
|
|
103
|
+
}),
|
|
104
|
+
controls: defaults({
|
|
105
|
+
attribution: false,
|
|
106
|
+
zoom: false,
|
|
107
|
+
rotate: false,
|
|
108
|
+
}),
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// 调用初始化基础图层的方法
|
|
112
|
+
initBaseLayers();
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const showPopup = () => {
|
|
116
|
+
shopPopup.value = true;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const closePopup = () => {
|
|
120
|
+
if (infoWindowRef.value) {
|
|
121
|
+
if (typeof infoWindowRef.value.destroyFlv === "function") {
|
|
122
|
+
infoWindowRef.value.destroyFlv();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
shopPopup.value = false;
|
|
126
|
+
// overlayPopup 从 useBaseLayers 中获取
|
|
127
|
+
if (overlayPopup.value) {
|
|
128
|
+
overlayPopup.value.setPosition(undefined);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const clickPointEvent = (obj) => {
|
|
133
|
+
emit("clickPointEvent", obj);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// 监听器
|
|
137
|
+
watch(() => props.mapZoom, (newVal) => {
|
|
138
|
+
if (map.value) {
|
|
139
|
+
const view = map.value.getView();
|
|
140
|
+
view.setZoom(Number(newVal));
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// 生命周期钩子
|
|
145
|
+
onMounted(() => {
|
|
146
|
+
initMap();
|
|
147
|
+
});
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<style scoped>
|
|
151
|
+
#map {
|
|
152
|
+
width: 100%;
|
|
153
|
+
height: var(--height);
|
|
154
|
+
}
|
|
155
|
+
.map-dark-background {
|
|
156
|
+
background: linear-gradient(to right, #1b2639 40%, #183157 60%);
|
|
157
|
+
}
|
|
158
|
+
.map-light-background {
|
|
159
|
+
background: #eeeee9;
|
|
160
|
+
}
|
|
161
|
+
.map-yingxiang-background {
|
|
162
|
+
background: transparent;
|
|
163
|
+
}
|
|
164
|
+
.theme-dark {
|
|
165
|
+
--border-color: #0061b5;
|
|
166
|
+
--background-color: rgba(1, 18, 56, 0.8);
|
|
167
|
+
--checkbox-label-color: #ffffff;
|
|
168
|
+
--checkbox-border-color: #0169c8;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.theme-light {
|
|
172
|
+
--border-color: #adacac;
|
|
173
|
+
--background-color: rgba(255, 255, 255, 0.8);
|
|
174
|
+
--checkbox-label-color: #000000;
|
|
175
|
+
--checkbox-border-color: #adacac;
|
|
176
|
+
}
|
|
177
|
+
.theme-yingxiang{
|
|
178
|
+
--border-color: #adacac;
|
|
179
|
+
--background-color: rgba(255, 255, 255, 0.65);
|
|
180
|
+
--checkbox-label-color: #000000;
|
|
181
|
+
--checkbox-border-color: #adacac;
|
|
182
|
+
}
|
|
183
|
+
</style>
|