diff --git a/package.json b/package.json index 33bf4a6f..7892f019 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "mapbox-gl-utils": "^0.44.0", "@mapbox/mapbox-gl-draw": "^1.4.1", "mapbox-gl-draw-snap-mode": "^0.2.0", + "terraformer-wkt-parser": "^1.2.1", "mars3d": "^3.7.0", "mars3d-cesium": "^1.113.0", "min-dash": "^4.2.1", diff --git a/public/combine.png b/public/combine.png index 388a91d4..da08822a 100644 Binary files a/public/combine.png and b/public/combine.png differ diff --git a/public/del.png b/public/del.png index 5e658a5a..1ec7e9ad 100644 Binary files a/public/del.png and b/public/del.png differ diff --git a/public/iocn/combine.png b/public/iocn/combine.png new file mode 100644 index 00000000..388a91d4 Binary files /dev/null and b/public/iocn/combine.png differ diff --git a/public/iocn/del.png b/public/iocn/del.png new file mode 100644 index 00000000..5e658a5a Binary files /dev/null and b/public/iocn/del.png differ diff --git a/public/iocn/line.png b/public/iocn/line.png new file mode 100644 index 00000000..6324eb7b Binary files /dev/null and b/public/iocn/line.png differ diff --git a/public/iocn/point.png b/public/iocn/point.png new file mode 100644 index 00000000..3ab5f87d Binary files /dev/null and b/public/iocn/point.png differ diff --git a/public/iocn/polygon.png b/public/iocn/polygon.png new file mode 100644 index 00000000..5649de6d Binary files /dev/null and b/public/iocn/polygon.png differ diff --git a/public/iocn/uncombine.png b/public/iocn/uncombine.png new file mode 100644 index 00000000..67e49367 Binary files /dev/null and b/public/iocn/uncombine.png differ diff --git a/public/line.png b/public/line.png index 6324eb7b..ebbba4d0 100644 Binary files a/public/line.png and b/public/line.png differ diff --git a/public/point.png b/public/point.png index 3ab5f87d..c19cf2c4 100644 Binary files a/public/point.png and b/public/point.png differ diff --git a/public/polygon.png b/public/polygon.png index 5649de6d..e103aca9 100644 Binary files a/public/polygon.png and b/public/polygon.png differ diff --git a/public/uncombine.png b/public/uncombine.png index 67e49367..666698a9 100644 Binary files a/public/uncombine.png and b/public/uncombine.png differ diff --git a/src/api/demo/formScheme.ts b/src/api/demo/formScheme.ts index aeb8dea0..e524c355 100644 --- a/src/api/demo/formScheme.ts +++ b/src/api/demo/formScheme.ts @@ -190,37 +190,6 @@ export function functionGetSchemePageList(params: schemePageListModel) { }); } -// 获取表单分页数据 【先不写】 -export function functionGetFormDataPage(params: AccountParams) { - return defHttp.post({ - url: Api.GetFormDataPage, - params, - }); -} -// 获取表单分页数据【先不写】 -export function functionGetFormDataList(params: AccountParams) { - return defHttp.post({ - url: Api.GetFormDataList, - params, - }); -} - -// 获取表单数据【先不写】 -export function functionGetFormDataFormScheme(params: AccountParams) { - return defHttp.get({ - url: Api.GetFormDataFormScheme, - params, - }); -} - -// 保存自定表单数据【先不写】 -export function functionsaveForm(params: AccountParams) { - return defHttp.post({ - url: Api.saveForm, - params, - }); -} - // CodeTable 数据对象模型管理 // 获取CodeTable的分页数据 export function function_Get_LoadCodeTablePage( @@ -280,10 +249,10 @@ export function LoadFormScheme(params) { export function AddTable(params) { params.dbColumnInfoList.push({ tableName: params.tableName, - dbColumnName: 'gemo', + dbColumnName: 'geom', dataType: 'geometry', length: 0, - columnDescription: 'gemo', + columnDescription: 'geom', isNullable: 0, isIdentity: 0, isPrimarykey: 0, @@ -296,9 +265,41 @@ export function AddTable(params) { } // 创建字段 + export function AddColumn(params) { return defHttp.post({ url: Api.AddColumn, params, }); } + +// 获取表单分页数据 【先不写】 +export function functionGetFormDataPage(params: AccountParams) { + return defHttp.post({ + url: Api.GetFormDataPage, + params, + }); +} +// 获取表单分页数据【先不写】 +export function functionGetFormDataList(params: AccountParams) { + return defHttp.post({ + url: Api.GetFormDataList, + params, + }); +} + +// 获取表单数据【先不写】 +export function functionGetFormDataFormScheme(params: AccountParams) { + return defHttp.get({ + url: Api.GetFormDataFormScheme, + params, + }); +} + +// 保存自定表单数据【先不写】 +export function functionsaveForm(params: AccountParams) { + return defHttp.post({ + url: Api.saveForm, + params, + }); +} diff --git a/src/components/MapboxMaps/DataListComponent/index.vue b/src/components/MapboxMaps/DataListComponent/index.vue index 4afdf7be..45ab0d9e 100644 --- a/src/components/MapboxMaps/DataListComponent/index.vue +++ b/src/components/MapboxMaps/DataListComponent/index.vue @@ -3,8 +3,12 @@ @@ -14,8 +18,10 @@ + \ No newline at end of file diff --git a/src/components/MapboxMaps/MapboxMap.vue b/src/components/MapboxMaps/MapboxMap.vue index a3931311..60ce4fa1 100644 --- a/src/components/MapboxMaps/MapboxMap.vue +++ b/src/components/MapboxMaps/MapboxMap.vue @@ -1,293 +1,294 @@ - - - - + const props = defineProps(); + + let nextMapControl: Array = reactive([]); + nextMapControl = props.control + ? props.control.map((item) => { + console.log('item::: ', item); + return MapControlConfig[item]; + }) + : []; + + console.log('nextMapControl::: ', nextMapControl); + + // 定义地图容器 + let map: Map; + let popup: Popup; + let clickPoisition: Array = []; + let selectFeature: Object = {}; + let mp: any = null; + + const { createConfirm, createMessage } = useMessage(); + + // 定义地图回调emit + // 地图加载完成回调 + const emit = defineEmits(['mapOnLoad', 'mapDraw']); + + onMounted(() => { + mapboxgl.accessToken = MapboxConfig.ACCESS_TOKEN; + map = initMap(); + map.on('load', () => { + //挂载mapbox-gl-utils + // U.init(map); + mp = new MP(map); + emit('mapOnLoad', map); + + // 初始化绘图空间 + handlerInitDrawTool(); + + map.on('click', (e) => { + clickPoisition = e.lngLat; + }); + + map.on('draw.selectionchange', (e) => { + handlerCopyToTargetLayer(e); + }); + + window.handlerCopyFeature = handlerCopyFeature; + }); + }); + // 销毁地图 + // 移除地图实例 + onUnmounted(() => { + map ? map.remove() : null; + }); + // 初始化地图 + // 返回地图实例 + const initMap = () => { + return new mapboxgl.Map({ + container: 'mapContainer', + language: 'zh-cmn', + projection: 'equirectangular', // wgs84参考系 + style: MapboxDefaultStyle, + maxZoom: 22, + minZoom: 6, + ...props.mapOptions, + }); + }; + + const handlerMapControlClick = (handler: string) => { + handler === 'handlerDrawPoint' && handlerDrawPoint(); + handler === 'handlerDrawLineString' && handlerDrawLineString(); + handler === 'handlerDrawPolygon' && handlerDrawPolygon(); + }; + //绘制点 + const handlerDrawPoint = () => { + mp.draw('Point'); + mp.on('Point', function (e) { + emit('mapDraw', 'Point', e); + }); + }; + //绘制线 + const handlerDrawLineString = () => { + mp.draw('LineString'); + mp.on('LineString', function (e) { + emit('mapDraw', 'LineString', e); + }); + }; + //绘制面 + const handlerDrawPolygon = () => { + mp.draw('Polygon'); + mp.on('Polygon', function (e) { + emit('mapDraw', 'Polygon', e); + }); + }; + //删除标记 + const handlerUnDraw = () => { + mp.deleteDraw(); + emit('mapDraw', 'cancel'); + }; + + // 初始化绘图空间 + const handlerInitDrawTool = () => { + let drawTool = new MapboxDraw({ + modes: { + ...MapboxDraw.modes, + draw_point: SnapPointMode, + draw_polygon: SnapPolygonMode, + draw_line_string: SnapLineMode, + direct_select: SnapDirectSelect, + }, + // Styling guides + styles: SnapModeDrawStyles, + userProperties: true, + // Config snapping features + snap: true, + snapOptions: { + snapPx: 15, // defaults to 15 + snapToMidPoints: true, // defaults to false + snapVertexPriorityDistance: 0.0025, // defaults to 1.25 + }, + guides: true, + }); + + map.addControl(drawTool, 'top-right'); + }; + + // 将图斑复制到指定图层 + const handlerCopyToTargetLayer = (e) => { + if (e.features.length > 0) { + if (popup) { + popup.remove(); + popup = null; + } + + selectFeature = e.features[0]; + + popup = new mapboxgl.Popup({ + closeButton: false, + closeOnClick: false, + }); + + // 设置 popup 的位置和内容 + popup + .setLngLat(clickPoisition) + .setHTML( + ` +
复制当前图斑
`, + ) + .addTo(map); + } else { + popup.remove(); + } + }; + + const handlerCopyFeature = () => { + console.log(selectFeature); + popup.remove(); + createMessage.success('复制成功!'); + }; + + + + \ No newline at end of file diff --git a/src/components/MapboxMaps/Modal/ServeResource/index.vue b/src/components/MapboxMaps/Modal/ServeResource/index.vue index c7f5717e..a5573758 100644 --- a/src/components/MapboxMaps/Modal/ServeResource/index.vue +++ b/src/components/MapboxMaps/Modal/ServeResource/index.vue @@ -38,8 +38,13 @@
+>>>>>>> 2aed0750b8d9679d2f0bc47b0c629ecf78313c2c @@ -84,10 +89,13 @@